diff options
| author | azazel <none@none> | 2010-08-08 22:54:58 +0600 |
|---|---|---|
| committer | azazel <none@none> | 2010-08-08 22:54:58 +0600 |
| commit | 590199d8e17405a0717eaf2e2d39f0d671b6f844 (patch) | |
| tree | 36755767c89c4639c7cb0e2f31d8a99f53bb8cf5 /src/server/scripts/EasternKingdoms | |
| parent | 8a69e50d6aff8ea75100a1fb660deecf03b3ea07 (diff) | |
* Rename InstanceData to InstanceScript
* Rename *mgr to their new names in scripts project
* Mass convert all the scripts (NEEDS THOROUGH TESTING, because it was done automatically) Please, report bugs on issue tracker.
--HG--
branch : trunk
rename : src/server/game/Instances/InstanceData.cpp => src/server/game/Instances/InstanceScript.cpp
rename : src/server/game/Instances/InstanceData.h => src/server/game/Instances/InstanceScript.h
Diffstat (limited to 'src/server/scripts/EasternKingdoms')
163 files changed, 25080 insertions, 24534 deletions
diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/blackrock_depths.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/blackrock_depths.cpp index 6b8d17b3f55..f2ac2705829 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockDepths/blackrock_depths.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/blackrock_depths.cpp @@ -43,23 +43,29 @@ EndContentData */ /*###### +## go_shadowforge_brazier +######*/ - -bool GOHello_go_shadowforge_brazier(Player* /*pPlayer*/, GameObject* pGo) +
class go_shadowforge_brazier : public GameObjectScript { - if (ScriptedInstance* pInstance = pGo->GetInstanceData()) +public: + go_shadowforge_brazier() : GameObjectScript("go_shadowforge_brazier") { } + + bool OnGossipHello(Player* /*pPlayer*/, GameObject* pGo) { - if (pInstance->GetData(TYPE_LYCEUM) == IN_PROGRESS) - pInstance->SetData(TYPE_LYCEUM, DONE); - else - pInstance->SetData(TYPE_LYCEUM, IN_PROGRESS); - // If used brazier open linked doors (North or South) - if (pGo->GetGUID() == pInstance->GetData64(DATA_SF_BRAZIER_N)) - pInstance->HandleGameObject(pInstance->GetData64(DATA_GOLEM_DOOR_N), true); - else if (pGo->GetGUID() == pInstance->GetData64(DATA_SF_BRAZIER_S)) - pInstance->HandleGameObject(pInstance->GetData64(DATA_GOLEM_DOOR_S), true); + if (InstanceScript* pInstance = pGo->GetInstanceScript()) + { + if (pInstance->GetData(TYPE_LYCEUM) == IN_PROGRESS) + pInstance->SetData(TYPE_LYCEUM, DONE); + else + pInstance->SetData(TYPE_LYCEUM, IN_PROGRESS); + // If used brazier open linked doors (North or South) + if (pGo->GetGUID() == pInstance->GetData64(DATA_SF_BRAZIER_N)) + pInstance->HandleGameObject(pInstance->GetData64(DATA_GOLEM_DOOR_N), true); + else if (pGo->GetGUID() == pInstance->GetData64(DATA_SF_BRAZIER_S)) + pInstance->HandleGameObject(pInstance->GetData64(DATA_GOLEM_DOOR_S), true); + } + return false; } - return false; -} + +}; /*###### ## npc_grimstone @@ -93,21 +99,27 @@ uint32 RingBoss[]= 9031, // Anub'shiah 9032, // Hedrum }; - -bool AreaTrigger_at_ring_of_law(Player* pPlayer, const AreaTriggerEntry * /*at*/) +
class at_ring_of_law : public AreaTriggerScript { - if (ScriptedInstance* pInstance = pPlayer->GetInstanceData()) +public: + at_ring_of_law() : AreaTriggerScript("at_ring_of_law") { } + + bool OnTrigger(Player* pPlayer, const AreaTriggerEntry * /*at*/) { - if (pInstance->GetData(TYPE_RING_OF_LAW) == IN_PROGRESS || pInstance->GetData(TYPE_RING_OF_LAW) == DONE) - return false; + if (InstanceScript* pInstance = pPlayer->GetInstanceScript()) + { + if (pInstance->GetData(TYPE_RING_OF_LAW) == IN_PROGRESS || pInstance->GetData(TYPE_RING_OF_LAW) == DONE) + return false; - pInstance->SetData(TYPE_RING_OF_LAW,IN_PROGRESS); - pPlayer->SummonCreature(NPC_GRIMSTONE,625.559,-205.618,-52.735,2.609,TEMPSUMMON_DEAD_DESPAWN,0); + pInstance->SetData(TYPE_RING_OF_LAW,IN_PROGRESS); + pPlayer->SummonCreature(NPC_GRIMSTONE,625.559,-205.618,-52.735,2.609,TEMPSUMMON_DEAD_DESPAWN,0); + return false; + } return false; } - return false; -} + +}; /*###### ## npc_grimstone @@ -123,228 +135,235 @@ enum GrimstoneTexts SCRIPT_TEXT6 = -1000005 }; -//TODO: implement quest part of event (different end boss) -struct npc_grimstoneAI : public npc_escortAI +//TODO: implement quest part of event (different end boss)
class npc_grimstone : public CreatureScript { - npc_grimstoneAI(Creature *c) : npc_escortAI(c) +public: + npc_grimstone() : CreatureScript("npc_grimstone") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); - MobSpawnId = rand()%6; + return new npc_grimstoneAI(pCreature); } - ScriptedInstance* pInstance; + struct npc_grimstoneAI : public npc_escortAI + { + npc_grimstoneAI(Creature *c) : npc_escortAI(c) + { + pInstance = c->GetInstanceScript(); + MobSpawnId = rand()%6; + } - uint8 EventPhase; - uint32 Event_Timer; + InstanceScript* pInstance; - uint8 MobSpawnId; - uint8 MobCount; - uint32 MobDeath_Timer; + uint8 EventPhase; + uint32 Event_Timer; - uint64 RingMobGUID[4]; - uint64 RingBossGUID; + uint8 MobSpawnId; + uint8 MobCount; + uint32 MobDeath_Timer; - bool CanWalk; + uint64 RingMobGUID[4]; + uint64 RingBossGUID; - void Reset() - { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + bool CanWalk; - EventPhase = 0; - Event_Timer = 1000; + void Reset() + { + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - MobCount = 0; - MobDeath_Timer = 0; + EventPhase = 0; + Event_Timer = 1000; - for (uint8 i = 0; i < MAX_MOB_AMOUNT; ++i) - RingMobGUID[i] = 0; + MobCount = 0; + MobDeath_Timer = 0; - RingBossGUID = 0; + for (uint8 i = 0; i < MAX_MOB_AMOUNT; ++i) + RingMobGUID[i] = 0; - CanWalk = false; - } + RingBossGUID = 0; - //TODO: move them to center - void SummonRingMob() - { - if (Creature* tmp = me->SummonCreature(RingMob[MobSpawnId],608.960,-235.322,-53.907,1.857,TEMPSUMMON_DEAD_DESPAWN,0)) - RingMobGUID[MobCount] = tmp->GetGUID(); + CanWalk = false; + } - ++MobCount; + //TODO: move them to center + void SummonRingMob() + { + if (Creature* tmp = me->SummonCreature(RingMob[MobSpawnId],608.960,-235.322,-53.907,1.857,TEMPSUMMON_DEAD_DESPAWN,0)) + RingMobGUID[MobCount] = tmp->GetGUID(); - if (MobCount == MAX_MOB_AMOUNT) - MobDeath_Timer = 2500; - } + ++MobCount; - //TODO: move them to center - void SummonRingBoss() - { - if (Creature* tmp = me->SummonCreature(RingBoss[rand()%6],644.300,-175.989,-53.739,3.418,TEMPSUMMON_DEAD_DESPAWN,0)) - RingBossGUID = tmp->GetGUID(); + if (MobCount == MAX_MOB_AMOUNT) + MobDeath_Timer = 2500; + } - MobDeath_Timer = 2500; - } + //TODO: move them to center + void SummonRingBoss() + { + if (Creature* tmp = me->SummonCreature(RingBoss[rand()%6],644.300,-175.989,-53.739,3.418,TEMPSUMMON_DEAD_DESPAWN,0)) + RingBossGUID = tmp->GetGUID(); - void WaypointReached(uint32 i) - { - switch(i) + MobDeath_Timer = 2500; + } + + void WaypointReached(uint32 i) { - case 0: - DoScriptText(SCRIPT_TEXT1, me);//2 - CanWalk = false; - Event_Timer = 5000; - break; - case 1: - DoScriptText(SCRIPT_TEXT2, me);//4 - CanWalk = false; - Event_Timer = 5000; - break; - case 2: - CanWalk = false; - break; - case 3: - DoScriptText(SCRIPT_TEXT3, me);//5 - break; - case 4: - DoScriptText(SCRIPT_TEXT4, me);//6 - CanWalk = false; - Event_Timer = 5000; - break; - case 5: - if (pInstance) + switch(i) { - pInstance->SetData(TYPE_RING_OF_LAW,DONE); - sLog.outDebug("TSCR: npc_grimstone: event reached end and set complete."); + case 0: + DoScriptText(SCRIPT_TEXT1, me);//2 + CanWalk = false; + Event_Timer = 5000; + break; + case 1: + DoScriptText(SCRIPT_TEXT2, me);//4 + CanWalk = false; + Event_Timer = 5000; + break; + case 2: + CanWalk = false; + break; + case 3: + DoScriptText(SCRIPT_TEXT3, me);//5 + break; + case 4: + DoScriptText(SCRIPT_TEXT4, me);//6 + CanWalk = false; + Event_Timer = 5000; + break; + case 5: + if (pInstance) + { + pInstance->SetData(TYPE_RING_OF_LAW,DONE); + sLog.outDebug("TSCR: npc_grimstone: event reached end and set complete."); + } + break; } - break; } - } - - void HandleGameObject(uint32 id, bool open) - { - pInstance->HandleGameObject(pInstance->GetData64(id), open); - } - void UpdateAI(const uint32 diff) - { - if (!pInstance) - return; + void HandleGameObject(uint32 id, bool open) + { + pInstance->HandleGameObject(pInstance->GetData64(id), open); + } - if (MobDeath_Timer) + void UpdateAI(const uint32 diff) { - if (MobDeath_Timer <= diff) - { - MobDeath_Timer = 2500; + if (!pInstance) + return; - if (RingBossGUID) + if (MobDeath_Timer) + { + if (MobDeath_Timer <= diff) { - Creature *boss = Unit::GetCreature(*me,RingBossGUID); - if (boss && !boss->isAlive() && boss->isDead()) + MobDeath_Timer = 2500; + + if (RingBossGUID) { - RingBossGUID = 0; - Event_Timer = 5000; - MobDeath_Timer = 0; + Creature *boss = Unit::GetCreature(*me,RingBossGUID); + if (boss && !boss->isAlive() && boss->isDead()) + { + RingBossGUID = 0; + Event_Timer = 5000; + MobDeath_Timer = 0; + return; + } return; } - return; - } - for (uint8 i = 0; i < MAX_MOB_AMOUNT; ++i) - { - Creature *mob = Unit::GetCreature(*me,RingMobGUID[i]); - if (mob && !mob->isAlive() && mob->isDead()) + for (uint8 i = 0; i < MAX_MOB_AMOUNT; ++i) { - RingMobGUID[i] = 0; - --MobCount; - - //seems all are gone, so set timer to continue and discontinue this - if (!MobCount) + Creature *mob = Unit::GetCreature(*me,RingMobGUID[i]); + if (mob && !mob->isAlive() && mob->isDead()) { - Event_Timer = 5000; - MobDeath_Timer = 0; + RingMobGUID[i] = 0; + --MobCount; + + //seems all are gone, so set timer to continue and discontinue this + if (!MobCount) + { + Event_Timer = 5000; + MobDeath_Timer = 0; + } } } - } - } else MobDeath_Timer -= diff; - } + } else MobDeath_Timer -= diff; + } - if (Event_Timer) - { - if (Event_Timer <= diff) + if (Event_Timer) { - switch(EventPhase) + if (Event_Timer <= diff) { - case 0: - DoScriptText(SCRIPT_TEXT5, me);//1 - HandleGameObject(DATA_ARENA4, false); - Start(false, false); - CanWalk = true; - Event_Timer = 0; - break; - case 1: - CanWalk = true; - Event_Timer = 0; - break; - case 2: - Event_Timer = 2000; - break; - case 3: - HandleGameObject(DATA_ARENA1, true); - Event_Timer = 3000; - break; - case 4: - CanWalk = true; - me->SetVisibility(VISIBILITY_OFF); - SummonRingMob(); - Event_Timer = 8000; - break; - case 5: - SummonRingMob(); - SummonRingMob(); - Event_Timer = 8000; - break; - case 6: - SummonRingMob(); - Event_Timer = 0; - break; - case 7: - me->SetVisibility(VISIBILITY_ON); - HandleGameObject(DATA_ARENA1, false); - DoScriptText(SCRIPT_TEXT6, me);//4 - CanWalk = true; - Event_Timer = 0; - break; - case 8: - HandleGameObject(DATA_ARENA2, true); - Event_Timer = 5000; - break; - case 9: - me->SetVisibility(VISIBILITY_OFF); - SummonRingBoss(); - Event_Timer = 0; - break; - case 10: - //if quest, complete - HandleGameObject(DATA_ARENA2, false); - HandleGameObject(DATA_ARENA3, true); - HandleGameObject(DATA_ARENA4, true); - CanWalk = true; - Event_Timer = 0; - break; - } - ++EventPhase; - } else Event_Timer -= diff; - } + switch(EventPhase) + { + case 0: + DoScriptText(SCRIPT_TEXT5, me);//1 + HandleGameObject(DATA_ARENA4, false); + Start(false, false); + CanWalk = true; + Event_Timer = 0; + break; + case 1: + CanWalk = true; + Event_Timer = 0; + break; + case 2: + Event_Timer = 2000; + break; + case 3: + HandleGameObject(DATA_ARENA1, true); + Event_Timer = 3000; + break; + case 4: + CanWalk = true; + me->SetVisibility(VISIBILITY_OFF); + SummonRingMob(); + Event_Timer = 8000; + break; + case 5: + SummonRingMob(); + SummonRingMob(); + Event_Timer = 8000; + break; + case 6: + SummonRingMob(); + Event_Timer = 0; + break; + case 7: + me->SetVisibility(VISIBILITY_ON); + HandleGameObject(DATA_ARENA1, false); + DoScriptText(SCRIPT_TEXT6, me);//4 + CanWalk = true; + Event_Timer = 0; + break; + case 8: + HandleGameObject(DATA_ARENA2, true); + Event_Timer = 5000; + break; + case 9: + me->SetVisibility(VISIBILITY_OFF); + SummonRingBoss(); + Event_Timer = 0; + break; + case 10: + //if quest, complete + HandleGameObject(DATA_ARENA2, false); + HandleGameObject(DATA_ARENA3, true); + HandleGameObject(DATA_ARENA4, true); + CanWalk = true; + Event_Timer = 0; + break; + } + ++EventPhase; + } else Event_Timer -= diff; + } + + if (CanWalk) + npc_escortAI::UpdateAI(diff); + } + }; - if (CanWalk) - npc_escortAI::UpdateAI(diff); - } }; -CreatureAI* GetAI_npc_grimstone(Creature* pCreature) -{ - return new npc_grimstoneAI(pCreature); -} /*###### ## mob_phalanx @@ -356,59 +375,66 @@ enum PhalanxSpells SPELL_FIREBALLVOLLEY = 22425, SPELL_MIGHTYBLOW = 14099 }; - -struct mob_phalanxAI : public ScriptedAI +
class mob_phalanx : public CreatureScript { - mob_phalanxAI(Creature *c) : ScriptedAI(c) {} +public: + mob_phalanx() : CreatureScript("mob_phalanx") { } - uint32 ThunderClap_Timer; - uint32 FireballVolley_Timer; - uint32 MightyBlow_Timer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - ThunderClap_Timer = 12000; - FireballVolley_Timer =0; - MightyBlow_Timer = 15000; + return new mob_phalanxAI (pCreature); } - void UpdateAI(const uint32 diff) + struct mob_phalanxAI : public ScriptedAI { - //Return since we have no target - if (!UpdateVictim()) - return; + mob_phalanxAI(Creature *c) : ScriptedAI(c) {} - //ThunderClap_Timer - if (ThunderClap_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_THUNDERCLAP); - ThunderClap_Timer = 10000; - } else ThunderClap_Timer -= diff; + uint32 ThunderClap_Timer; + uint32 FireballVolley_Timer; + uint32 MightyBlow_Timer; - //FireballVolley_Timer - if (me->GetHealth()*100 / me->GetMaxHealth() < 51) + void Reset() { - if (FireballVolley_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_FIREBALLVOLLEY); - FireballVolley_Timer = 15000; - } else FireballVolley_Timer -= diff; + ThunderClap_Timer = 12000; + FireballVolley_Timer =0; + MightyBlow_Timer = 15000; } - //MightyBlow_Timer - if (MightyBlow_Timer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_MIGHTYBLOW); - MightyBlow_Timer = 10000; - } else MightyBlow_Timer -= diff; + //Return since we have no target + if (!UpdateVictim()) + return; + + //ThunderClap_Timer + if (ThunderClap_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_THUNDERCLAP); + ThunderClap_Timer = 10000; + } else ThunderClap_Timer -= diff; + + //FireballVolley_Timer + if (me->GetHealth()*100 / me->GetMaxHealth() < 51) + { + if (FireballVolley_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_FIREBALLVOLLEY); + FireballVolley_Timer = 15000; + } else FireballVolley_Timer -= diff; + } + + //MightyBlow_Timer + if (MightyBlow_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_MIGHTYBLOW); + MightyBlow_Timer = 10000; + } else MightyBlow_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_mob_phalanx(Creature* pCreature) -{ - return new mob_phalanxAI (pCreature); -} /*###### ## npc_kharan_mighthammer @@ -431,73 +457,80 @@ enum KharamQuests #define GOSSIP_ITEM_KHARAN_8 "Continue with your story please." #define GOSSIP_ITEM_KHARAN_9 "Indeed." #define GOSSIP_ITEM_KHARAN_10 "The door is open, Kharan. You are a free man." - -bool GossipHello_npc_kharan_mighthammer(Player* pPlayer, Creature* pCreature) +
class npc_kharan_mighthammer : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); +public: + npc_kharan_mighthammer() : CreatureScript("npc_kharan_mighthammer") { } + + 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_ITEM_KHARAN_3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); + pPlayer->SEND_GOSSIP_MENU(2475, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+2: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_KHARAN_4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); + pPlayer->SEND_GOSSIP_MENU(2476, pCreature->GetGUID()); + break; + + case GOSSIP_ACTION_INFO_DEF+3: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_KHARAN_5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4); + pPlayer->SEND_GOSSIP_MENU(2477, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+4: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_KHARAN_6, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5); + pPlayer->SEND_GOSSIP_MENU(2478, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+5: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_KHARAN_7, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+6); + pPlayer->SEND_GOSSIP_MENU(2479, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+6: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_KHARAN_8, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+7); + pPlayer->SEND_GOSSIP_MENU(2480, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+7: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_KHARAN_9, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+8); + pPlayer->SEND_GOSSIP_MENU(2481, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+8: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_KHARAN_10, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+9); + pPlayer->SEND_GOSSIP_MENU(2482, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+9: + pPlayer->CLOSE_GOSSIP_MENU(); + if (pPlayer->GetTeam() == HORDE) + pPlayer->AreaExploredOrEventHappens(QUEST_4001); + else + pPlayer->AreaExploredOrEventHappens(QUEST_4342); + break; + } + return true; + } - if (pPlayer->GetQuestStatus(QUEST_4001) == QUEST_STATUS_INCOMPLETE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_KHARAN_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if (pPlayer->GetQuestStatus(4342) == QUEST_STATUS_INCOMPLETE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_KHARAN_2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); + if (pPlayer->GetQuestStatus(QUEST_4001) == QUEST_STATUS_INCOMPLETE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_KHARAN_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - if (pPlayer->GetTeam() == HORDE) - pPlayer->SEND_GOSSIP_MENU(2473, pCreature->GetGUID()); - else - pPlayer->SEND_GOSSIP_MENU(2474, pCreature->GetGUID()); + if (pPlayer->GetQuestStatus(4342) == QUEST_STATUS_INCOMPLETE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_KHARAN_2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); - return true; -} + if (pPlayer->GetTeam() == HORDE) + pPlayer->SEND_GOSSIP_MENU(2473, pCreature->GetGUID()); + else + pPlayer->SEND_GOSSIP_MENU(2474, pCreature->GetGUID()); -bool GossipSelect_npc_kharan_mighthammer(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - switch (uiAction) - { - case GOSSIP_ACTION_INFO_DEF+1: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_KHARAN_3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); - pPlayer->SEND_GOSSIP_MENU(2475, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+2: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_KHARAN_4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); - pPlayer->SEND_GOSSIP_MENU(2476, pCreature->GetGUID()); - break; - - case GOSSIP_ACTION_INFO_DEF+3: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_KHARAN_5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4); - pPlayer->SEND_GOSSIP_MENU(2477, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+4: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_KHARAN_6, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5); - pPlayer->SEND_GOSSIP_MENU(2478, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+5: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_KHARAN_7, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+6); - pPlayer->SEND_GOSSIP_MENU(2479, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+6: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_KHARAN_8, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+7); - pPlayer->SEND_GOSSIP_MENU(2480, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+7: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_KHARAN_9, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+8); - pPlayer->SEND_GOSSIP_MENU(2481, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+8: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_KHARAN_10, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+9); - pPlayer->SEND_GOSSIP_MENU(2482, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+9: - pPlayer->CLOSE_GOSSIP_MENU(); - if (pPlayer->GetTeam() == HORDE) - pPlayer->AreaExploredOrEventHappens(QUEST_4001); - else - pPlayer->AreaExploredOrEventHappens(QUEST_4342); - break; + return true; } - return true; -} + +}; + /*###### ## npc_lokhtos_darkbargainer @@ -521,42 +554,49 @@ enum LokhtosSpells #define GOSSIP_ITEM_SHOW_ACCESS "Show me what I have access to, Lothos." #define GOSSIP_ITEM_GET_CONTRACT "Get Thorium Brotherhood Contract" - -bool GossipHello_npc_lokhtos_darkbargainer(Player* pPlayer, Creature* pCreature) +
class npc_lokhtos_darkbargainer : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - - if (pCreature->isVendor() && pPlayer->GetReputationRank(59) >= REP_FRIENDLY) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_ITEM_SHOW_ACCESS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); +public: + npc_lokhtos_darkbargainer() : CreatureScript("npc_lokhtos_darkbargainer") { } - if (pPlayer->GetQuestRewardStatus(QUEST_A_BINDING_CONTRACT) != 1 && - !pPlayer->HasItemCount(ITEM_THRORIUM_BROTHERHOOD_CONTRACT, 1, true) && - pPlayer->HasItemCount(ITEM_SULFURON_INGOT, 1)) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_GET_CONTRACT, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + if (uiAction == GOSSIP_ACTION_INFO_DEF + 1) + { + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->CastSpell(pPlayer, SPELL_CREATE_THORIUM_BROTHERHOOD_CONTRACT_DND, false); + } + if (uiAction == GOSSIP_ACTION_TRADE) + pPlayer->SEND_VENDORLIST(pCreature->GetGUID()); + + return true; } - if (pPlayer->GetReputationRank(59) < REP_FRIENDLY) - pPlayer->SEND_GOSSIP_MENU(3673, pCreature->GetGUID()); - else - pPlayer->SEND_GOSSIP_MENU(3677, pCreature->GetGUID()); + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - return true; -} + if (pCreature->isVendor() && pPlayer->GetReputationRank(59) >= REP_FRIENDLY) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_ITEM_SHOW_ACCESS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); -bool GossipSelect_npc_lokhtos_darkbargainer(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF + 1) - { - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->CastSpell(pPlayer, SPELL_CREATE_THORIUM_BROTHERHOOD_CONTRACT_DND, false); + if (pPlayer->GetQuestRewardStatus(QUEST_A_BINDING_CONTRACT) != 1 && + !pPlayer->HasItemCount(ITEM_THRORIUM_BROTHERHOOD_CONTRACT, 1, true) && + pPlayer->HasItemCount(ITEM_SULFURON_INGOT, 1)) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_GET_CONTRACT, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + } + + if (pPlayer->GetReputationRank(59) < REP_FRIENDLY) + pPlayer->SEND_GOSSIP_MENU(3673, pCreature->GetGUID()); + else + pPlayer->SEND_GOSSIP_MENU(3677, pCreature->GetGUID()); + + return true; } - if (uiAction == GOSSIP_ACTION_TRADE) - pPlayer->SEND_VENDORLIST(pCreature->GetGUID()); - return true; -} +}; + /*###### ## npc_dughal_stormwing @@ -570,89 +610,98 @@ enum DughalQuests #define SAY_DUGHAL_FREE "Thank you, $N! I'm free!!!" #define GOSSIP_DUGHAL "You're free, Dughal! Get out of here!" -/* -struct npc_dughal_stormwingAI : public npc_escortAI +/*
class npc_dughal_stormwing : public CreatureScript { - npc_dughal_stormwingAI(Creature *c) : npc_escortAI(c) {} +public: + npc_dughal_stormwing() : CreatureScript("npc_dughal_stormwing") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + npc_dughal_stormwingAI* dughal_stormwingAI = new npc_dughal_stormwingAI(pCreature); + + dughal_stormwingAI->AddWaypoint(0, 280.42,-82.86, -77.12,0); + dughal_stormwingAI->AddWaypoint(1, 287.64,-87.01, -76.79,0); + dughal_stormwingAI->AddWaypoint(2, 354.63,-64.95, -67.53,0); + + return dughal_stormwingAI; + } - void WaypointReached(uint32 i) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { - switch(i) + if (uiAction == GOSSIP_ACTION_INFO_DEF + 1) { - case 0:me->Say(SAY_DUGHAL_FREE, LANG_UNIVERSAL, PlayerGUID); break; - case 1:pInstance->SetData(DATA_DUGHAL,ENCOUNTER_STATE_OBJECTIVE_COMPLETED);break; - case 2: - me->SetVisibility(VISIBILITY_OFF); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - pInstance->SetData(DATA_DUGHAL,ENCOUNTER_STATE_ENDED); - break; + pPlayer->CLOSE_GOSSIP_MENU(); + CAST_AI(npc_escort::npc_escortAI, (pCreature->AI()))->Start(false, true, pPlayer->GetGUID()); + pCreature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + pInstance->SetData(DATA_QUEST_JAIL_BREAK,ENCOUNTER_STATE_IN_PROGRESS); } + return true; } - void EnterCombat(Unit* who) {} - void Reset() {} - - void JustDied(Unit* killer) + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - if (IsBeingEscorted && killer == me) + if (pPlayer->GetQuestStatus(QUEST_JAIL_BREAK) == QUEST_STATUS_INCOMPLETE && pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_IN_PROGRESS) { - me->SetVisibility(VISIBILITY_OFF); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - pInstance->SetData(DATA_DUGHAL,ENCOUNTER_STATE_ENDED); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_DUGHAL, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + pPlayer->SEND_GOSSIP_MENU(2846, pCreature->GetGUID()); } + return true; } - void UpdateAI(const uint32 diff) + struct npc_dughal_stormwingAI : public npc_escortAI { - if (pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_NOT_STARTED) return; - if ((pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_IN_PROGRESS || pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_FAILED || pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_ENDED)&& pInstance->GetData(DATA_DUGHAL) == ENCOUNTER_STATE_ENDED) + npc_dughal_stormwingAI(Creature *c) : npc_escortAI(c) {} + + void WaypointReached(uint32 i) { - me->SetVisibility(VISIBILITY_OFF); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + switch(i) + { + case 0:me->Say(SAY_DUGHAL_FREE, LANG_UNIVERSAL, PlayerGUID); break; + case 1:pInstance->SetData(DATA_DUGHAL,ENCOUNTER_STATE_OBJECTIVE_COMPLETED);break; + case 2: + me->SetVisibility(VISIBILITY_OFF); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + pInstance->SetData(DATA_DUGHAL,ENCOUNTER_STATE_ENDED); + break; + } } - else + + void EnterCombat(Unit* who) {} + void Reset() {} + + void JustDied(Unit* killer) { - me->SetVisibility(VISIBILITY_ON); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + if (IsBeingEscorted && killer == me) + { + me->SetVisibility(VISIBILITY_OFF); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + pInstance->SetData(DATA_DUGHAL,ENCOUNTER_STATE_ENDED); + } } - npc_escortAI::UpdateAI(diff); - } -}; -CreatureAI* GetAI_npc_dughal_stormwing(Creature* pCreature) -{ - npc_dughal_stormwingAI* dughal_stormwingAI = new npc_dughal_stormwingAI(pCreature); - dughal_stormwingAI->AddWaypoint(0, 280.42,-82.86, -77.12,0); - dughal_stormwingAI->AddWaypoint(1, 287.64,-87.01, -76.79,0); - dughal_stormwingAI->AddWaypoint(2, 354.63,-64.95, -67.53,0); + void UpdateAI(const uint32 diff) + { + if (pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_NOT_STARTED) return; + if ((pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_IN_PROGRESS || pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_FAILED || pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_ENDED)&& pInstance->GetData(DATA_DUGHAL) == ENCOUNTER_STATE_ENDED) + { + me->SetVisibility(VISIBILITY_OFF); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + } + else + { + me->SetVisibility(VISIBILITY_ON); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + } + npc_escortAI::UpdateAI(diff); + } + }; - return dughal_stormwingAI; -} -bool GossipHello_npc_dughal_stormwing(Player* pPlayer, Creature* pCreature) -{ - if (pPlayer->GetQuestStatus(QUEST_JAIL_BREAK) == QUEST_STATUS_INCOMPLETE && pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_IN_PROGRESS) - { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_DUGHAL, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - pPlayer->SEND_GOSSIP_MENU(2846, pCreature->GetGUID()); - } - return true; -} +}; -bool GossipSelect_npc_dughal_stormwing(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF + 1) - { - pPlayer->CLOSE_GOSSIP_MENU(); - CAST_AI(npc_escortAI, (pCreature->AI()))->Start(false, true, pPlayer->GetGUID()); - pCreature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - pInstance->SetData(DATA_QUEST_JAIL_BREAK,ENCOUNTER_STATE_IN_PROGRESS); - } - return true; -} */ /*###### ## npc_marshal_windsor @@ -670,148 +719,156 @@ bool GossipSelect_npc_dughal_stormwing(Player* pPlayer, Creature* pCreature, uin #define MOB_ENTRY_REGINALD_WINDSOR 9682 Player* pPlayerStart; -/* -struct npc_marshal_windsorAI : public npc_escortAI +/*
class npc_marshal_windsor : public CreatureScript { - npc_marshal_windsorAI(Creature *c) : npc_escortAI(c) +public: + npc_marshal_windsor() : CreatureScript("npc_marshal_windsor") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + npc_marshal_windsorAI* marshal_windsorAI = new npc_marshal_windsorAI(pCreature); + + marshal_windsorAI->AddWaypoint(0, 316.336,-225.528, -77.7258,7000); + marshal_windsorAI->AddWaypoint(1, 316.336,-225.528, -77.7258,2000); + marshal_windsorAI->AddWaypoint(2, 322.96,-207.13, -77.87,0); + marshal_windsorAI->AddWaypoint(3, 281.05,-172.16, -75.12,0); + marshal_windsorAI->AddWaypoint(4, 272.19,-139.14, -70.61,0); + marshal_windsorAI->AddWaypoint(5, 283.62,-116.09, -70.21,0); + marshal_windsorAI->AddWaypoint(6, 296.18,-94.30, -74.08,0); + marshal_windsorAI->AddWaypoint(7, 294.57,-93.11, -74.08,0); + marshal_windsorAI->AddWaypoint(8, 314.31,-74.31, -76.09,0); + marshal_windsorAI->AddWaypoint(9, 360.22,-62.93, -66.77,0); + marshal_windsorAI->AddWaypoint(10, 383.38,-69.40, -63.25,0); + marshal_windsorAI->AddWaypoint(11, 389.99,-67.86, -62.57,0); + marshal_windsorAI->AddWaypoint(12, 400.98,-72.01, -62.31,0); + marshal_windsorAI->AddWaypoint(13, 404.22,-62.30, -63.50,2300); + marshal_windsorAI->AddWaypoint(14, 404.22,-62.30, -63.50,1500); + marshal_windsorAI->AddWaypoint(15, 407.65,-51.86, -63.96,0); + marshal_windsorAI->AddWaypoint(16, 403.61,-51.71, -63.92,1000); + marshal_windsorAI->AddWaypoint(17, 403.61,-51.71, -63.92,2000); + marshal_windsorAI->AddWaypoint(18, 403.61,-51.71, -63.92,1000); + marshal_windsorAI->AddWaypoint(19, 403.61,-51.71, -63.92,0); + + return marshal_windsorAI; } - void WaypointReached(uint32 i) + bool OnQuestAccept(Player* pPlayer, Creature* pCreature, Quest const *quest) { - switch(i) - { - case 1: - me->Say(SAY_WINDSOR_1, LANG_UNIVERSAL, PlayerGUID); - break; - case 7: - me->HandleEmoteCommand(EMOTE_STATE_POINT); - me->Say(SAY_WINDSOR_4_1, LANG_UNIVERSAL, PlayerGUID); - IsOnHold=true; - break; - case 10: - me->setFaction(534); - break; - case 12: - me->Say(SAY_WINDSOR_6, LANG_UNIVERSAL, PlayerGUID); - pInstance->SetData(DATA_SUPPLY_ROOM, ENCOUNTER_STATE_IN_PROGRESS); - break; - case 13: - me->HandleEmoteCommand(EMOTE_STATE_USESTANDING);//EMOTE_STATE_WORK - break; - case 14: - pInstance->SetData(DATA_GATE_SR,0); - me->setFaction(11); - break; - case 16: - me->Say(SAY_WINDSOR_9, LANG_UNIVERSAL, PlayerGUID); - break; - case 17: - me->HandleEmoteCommand(EMOTE_STATE_USESTANDING);//EMOTE_STATE_WORK - break; - case 18: - pInstance->SetData(DATA_GATE_SC,0); - break; - case 19: - me->SetVisibility(VISIBILITY_OFF); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->SummonCreature(MOB_ENTRY_REGINALD_WINDSOR,403.61,-51.71,-63.92,3.600434,TEMPSUMMON_DEAD_DESPAWN ,0); - pInstance->SetData(DATA_SUPPLY_ROOM, ENCOUNTER_STATE_ENDED); - break; - } + if (quest->GetQuestId() == 4322) + {PlayerStart = player; + if (pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_NOT_STARTED) + { + CAST_AI(npc_escort::npc_escortAI, (pCreature->AI()))->Start(true, false, pPlayer->GetGUID()); + pInstance->SetData(DATA_QUEST_JAIL_BREAK,ENCOUNTER_STATE_IN_PROGRESS); + pCreature->setFaction(11); + } + + } + return false; } - void EnterCombat(Unit* who) - { - switch (urand(0,2)) + struct npc_marshal_windsorAI : public npc_escortAI + { + npc_marshal_windsorAI(Creature *c) : npc_escortAI(c) { - case 0: me->Say(SAY_WINDSOR_AGGRO1, LANG_UNIVERSAL, PlayerGUID); break; - case 1: me->Say(SAY_WINDSOR_AGGRO2, LANG_UNIVERSAL, PlayerGUID); break; - case 2: me->Say(SAY_WINDSOR_AGGRO3, LANG_UNIVERSAL, PlayerGUID); break; - } + pInstance = c->GetInstanceScript(); } - void Reset() {} - - void JustDied(Unit *slayer) - { - pInstance->SetData(DATA_QUEST_JAIL_BREAK,ENCOUNTER_STATE_FAILED); - } - - void UpdateAI(const uint32 diff) - { - if (pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_NOT_STARTED) return; - if (pInstance->GetData(DATA_DUGHAL) == ENCOUNTER_STATE_OBJECTIVE_COMPLETED) - SetEscortPaused(false); - if (!pInstance->GetData(DATA_GATE_D) && pInstance->GetData(DATA_DUGHAL) == ENCOUNTER_STATE_NOT_STARTED) + void WaypointReached(uint32 i) + { + switch(i) { - me->Say(SAY_WINDSOR_4_2, LANG_UNIVERSAL, PlayerGUID); - pInstance->SetData(DATA_DUGHAL, ENCOUNTER_STATE_BEFORE_START); + case 1: + me->Say(SAY_WINDSOR_1, LANG_UNIVERSAL, PlayerGUID); + break; + case 7: + me->HandleEmoteCommand(EMOTE_STATE_POINT); + me->Say(SAY_WINDSOR_4_1, LANG_UNIVERSAL, PlayerGUID); + IsOnHold=true; + break; + case 10: + me->setFaction(534); + break; + case 12: + me->Say(SAY_WINDSOR_6, LANG_UNIVERSAL, PlayerGUID); + pInstance->SetData(DATA_SUPPLY_ROOM, ENCOUNTER_STATE_IN_PROGRESS); + break; + case 13: + me->HandleEmoteCommand(EMOTE_STATE_USESTANDING);//EMOTE_STATE_WORK + break; + case 14: + pInstance->SetData(DATA_GATE_SR,0); + me->setFaction(11); + break; + case 16: + me->Say(SAY_WINDSOR_9, LANG_UNIVERSAL, PlayerGUID); + break; + case 17: + me->HandleEmoteCommand(EMOTE_STATE_USESTANDING);//EMOTE_STATE_WORK + break; + case 18: + pInstance->SetData(DATA_GATE_SC,0); + break; + case 19: + me->SetVisibility(VISIBILITY_OFF); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->SummonCreature(MOB_ENTRY_REGINALD_WINDSOR,403.61,-51.71,-63.92,3.600434,TEMPSUMMON_DEAD_DESPAWN ,0); + pInstance->SetData(DATA_SUPPLY_ROOM, ENCOUNTER_STATE_ENDED); + break; } - if (pInstance->GetData(DATA_DUGHAL) == ENCOUNTER_STATE_OBJECTIVE_COMPLETED) + } + + void EnterCombat(Unit* who) { - me->Say(SAY_WINDSOR_4_3, LANG_UNIVERSAL, PlayerGUID); - pInstance->SetData(DATA_DUGHAL, ENCOUNTER_STATE_ENDED); + switch (urand(0,2)) + { + case 0: me->Say(SAY_WINDSOR_AGGRO1, LANG_UNIVERSAL, PlayerGUID); break; + case 1: me->Say(SAY_WINDSOR_AGGRO2, LANG_UNIVERSAL, PlayerGUID); break; + case 2: me->Say(SAY_WINDSOR_AGGRO3, LANG_UNIVERSAL, PlayerGUID); break; } - if ((pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_IN_PROGRESS || pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_FAILED || pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_ENDED)&& pInstance->GetData(DATA_SUPPLY_ROOM) == ENCOUNTER_STATE_ENDED) - { - me->SetVisibility(VISIBILITY_OFF); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - } - else + } + + void Reset() {} + + void JustDied(Unit *slayer) { - me->SetVisibility(VISIBILITY_ON); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + pInstance->SetData(DATA_QUEST_JAIL_BREAK,ENCOUNTER_STATE_FAILED); } - npc_escortAI::UpdateAI(diff); - } -}; -CreatureAI* GetAI_npc_marshal_windsor(Creature* pCreature) -{ - npc_marshal_windsorAI* marshal_windsorAI = new npc_marshal_windsorAI(pCreature); - - marshal_windsorAI->AddWaypoint(0, 316.336,-225.528, -77.7258,7000); - marshal_windsorAI->AddWaypoint(1, 316.336,-225.528, -77.7258,2000); - marshal_windsorAI->AddWaypoint(2, 322.96,-207.13, -77.87,0); - marshal_windsorAI->AddWaypoint(3, 281.05,-172.16, -75.12,0); - marshal_windsorAI->AddWaypoint(4, 272.19,-139.14, -70.61,0); - marshal_windsorAI->AddWaypoint(5, 283.62,-116.09, -70.21,0); - marshal_windsorAI->AddWaypoint(6, 296.18,-94.30, -74.08,0); - marshal_windsorAI->AddWaypoint(7, 294.57,-93.11, -74.08,0); - marshal_windsorAI->AddWaypoint(8, 314.31,-74.31, -76.09,0); - marshal_windsorAI->AddWaypoint(9, 360.22,-62.93, -66.77,0); - marshal_windsorAI->AddWaypoint(10, 383.38,-69.40, -63.25,0); - marshal_windsorAI->AddWaypoint(11, 389.99,-67.86, -62.57,0); - marshal_windsorAI->AddWaypoint(12, 400.98,-72.01, -62.31,0); - marshal_windsorAI->AddWaypoint(13, 404.22,-62.30, -63.50,2300); - marshal_windsorAI->AddWaypoint(14, 404.22,-62.30, -63.50,1500); - marshal_windsorAI->AddWaypoint(15, 407.65,-51.86, -63.96,0); - marshal_windsorAI->AddWaypoint(16, 403.61,-51.71, -63.92,1000); - marshal_windsorAI->AddWaypoint(17, 403.61,-51.71, -63.92,2000); - marshal_windsorAI->AddWaypoint(18, 403.61,-51.71, -63.92,1000); - marshal_windsorAI->AddWaypoint(19, 403.61,-51.71, -63.92,0); - - return marshal_windsorAI; -} -bool QuestAccept_npc_marshal_windsor(Player* pPlayer, Creature* pCreature, Quest const *quest) -{ - if (quest->GetQuestId() == 4322) - {PlayerStart = player; - if (pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_NOT_STARTED) + void UpdateAI(const uint32 diff) { - CAST_AI(npc_escortAI, (pCreature->AI()))->Start(true, false, pPlayer->GetGUID()); - pInstance->SetData(DATA_QUEST_JAIL_BREAK,ENCOUNTER_STATE_IN_PROGRESS); - pCreature->setFaction(11); + if (pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_NOT_STARTED) return; + if (pInstance->GetData(DATA_DUGHAL) == ENCOUNTER_STATE_OBJECTIVE_COMPLETED) + SetEscortPaused(false); + if (!pInstance->GetData(DATA_GATE_D) && pInstance->GetData(DATA_DUGHAL) == ENCOUNTER_STATE_NOT_STARTED) + { + me->Say(SAY_WINDSOR_4_2, LANG_UNIVERSAL, PlayerGUID); + pInstance->SetData(DATA_DUGHAL, ENCOUNTER_STATE_BEFORE_START); + } + if (pInstance->GetData(DATA_DUGHAL) == ENCOUNTER_STATE_OBJECTIVE_COMPLETED) + { + me->Say(SAY_WINDSOR_4_3, LANG_UNIVERSAL, PlayerGUID); + pInstance->SetData(DATA_DUGHAL, ENCOUNTER_STATE_ENDED); + } + if ((pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_IN_PROGRESS || pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_FAILED || pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_ENDED)&& pInstance->GetData(DATA_SUPPLY_ROOM) == ENCOUNTER_STATE_ENDED) + { + me->SetVisibility(VISIBILITY_OFF); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + } + else + { + me->SetVisibility(VISIBILITY_ON); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + } + npc_escortAI::UpdateAI(diff); } + }; + +}; - } - return false; -} */ /*###### ## npc_marshal_reginald_windsor @@ -835,289 +892,305 @@ bool QuestAccept_npc_marshal_windsor(Player* pPlayer, Creature* pCreature, Quest #define MOB_ENTRY_CREST_KILLER 9680 int wp = 0; -/* -struct npc_marshal_reginald_windsorAI : public npc_escortAI +/*
class npc_marshal_reginald_windsor : public CreatureScript { - npc_marshal_reginald_windsorAI(Creature *c) : npc_escortAI(c) +public: + npc_marshal_reginald_windsor() : CreatureScript("npc_marshal_reginald_windsor") { } + + CreatureAI* GetAI(Creature* pCreature) const { + npc_marshal_reginald_windsorAI* marshal_reginald_windsorAI = new npc_marshal_reginald_windsorAI(pCreature); + + marshal_reginald_windsorAI->AddWaypoint(0, 403.61,-52.71, -63.92,4000); + marshal_reginald_windsorAI->AddWaypoint(1, 403.61,-52.71, -63.92,4000); + marshal_reginald_windsorAI->AddWaypoint(2, 406.33,-54.87, -63.95,0); + marshal_reginald_windsorAI->AddWaypoint(3, 407.99,-73.91, -62.26,0); + marshal_reginald_windsorAI->AddWaypoint(4, 557.03,-119.71, -61.83,0); + marshal_reginald_windsorAI->AddWaypoint(5, 573.40,-124.39, -65.07,0); + marshal_reginald_windsorAI->AddWaypoint(6, 593.91,-130.29, -69.25,0); + marshal_reginald_windsorAI->AddWaypoint(7, 593.21,-132.16, -69.25,0); + marshal_reginald_windsorAI->AddWaypoint(8, 593.21,-132.16, -69.25,3000); + marshal_reginald_windsorAI->AddWaypoint(9, 622.81,-135.55, -71.92,0); + marshal_reginald_windsorAI->AddWaypoint(10, 634.68,-151.29, -70.32,0); + marshal_reginald_windsorAI->AddWaypoint(11, 635.06,-153.25, -70.32,0); + marshal_reginald_windsorAI->AddWaypoint(12, 635.06,-153.25, -70.32,3000); + marshal_reginald_windsorAI->AddWaypoint(13, 635.06,-153.25, -70.32,1500); + marshal_reginald_windsorAI->AddWaypoint(14, 655.25,-172.39, -73.72,0); + marshal_reginald_windsorAI->AddWaypoint(15, 654.79,-226.30, -83.06,0); + marshal_reginald_windsorAI->AddWaypoint(16, 622.85,-268.85, -83.96,0); + marshal_reginald_windsorAI->AddWaypoint(17, 579.45,-275.56, -80.44,0); + marshal_reginald_windsorAI->AddWaypoint(18, 561.19,-266.85, -75.59,0); + marshal_reginald_windsorAI->AddWaypoint(19, 547.91,-253.92, -70.34,0); + marshal_reginald_windsorAI->AddWaypoint(20, 549.20,-252.40, -70.34,0); + marshal_reginald_windsorAI->AddWaypoint(21, 549.20,-252.40, -70.34,4000); + marshal_reginald_windsorAI->AddWaypoint(22, 555.33,-269.16, -74.40,0); + marshal_reginald_windsorAI->AddWaypoint(23, 554.31,-270.88, -74.40,0); + marshal_reginald_windsorAI->AddWaypoint(24, 554.31,-270.88, -74.40,4000); + marshal_reginald_windsorAI->AddWaypoint(25, 536.10,-249.60, -67.47,0); + marshal_reginald_windsorAI->AddWaypoint(26, 520.94,-216.65, -59.28,0); + marshal_reginald_windsorAI->AddWaypoint(27, 505.99,-148.74, -62.17,0); + marshal_reginald_windsorAI->AddWaypoint(28, 484.21,-56.24, -62.43,0); + marshal_reginald_windsorAI->AddWaypoint(29, 470.39,-6.01, -70.10,0); + marshal_reginald_windsorAI->AddWaypoint(30, 451.27,30.85, -70.07,0); + marshal_reginald_windsorAI->AddWaypoint(31, 452.45,29.85, -70.37,1500); + marshal_reginald_windsorAI->AddWaypoint(32, 452.45,29.85, -70.37,7000); + marshal_reginald_windsorAI->AddWaypoint(33, 452.45,29.85, -70.37,10000); + marshal_reginald_windsorAI->AddWaypoint(34, 451.27,31.85, -70.07,0); + + return marshal_reginald_windsorAI; } - void WaypointReached(uint32 i) + struct npc_marshal_reginald_windsorAI : public npc_escortAI { - wp=i; - switch(i) + npc_marshal_reginald_windsorAI(Creature *c) : npc_escortAI(c) { - case 0: - me->setFaction(11); - me->Say(SAY_REGINALD_WINDSOR_0_1, LANG_UNIVERSAL, PlayerGUID); - break; - case 1: - me->Say(SAY_REGINALD_WINDSOR_0_2, LANG_UNIVERSAL, PlayerGUID); - break; - case 7: - me->HandleEmoteCommand(EMOTE_STATE_POINT); - me->Say(SAY_REGINALD_WINDSOR_5_1, LANG_UNIVERSAL, PlayerGUID); - IsOnHold=true; - break; - case 8: - me->Say(SAY_REGINALD_WINDSOR_5_2, LANG_UNIVERSAL, PlayerGUID); - break; - case 11: - me->HandleEmoteCommand(EMOTE_STATE_POINT); - me->Say(SAY_REGINALD_WINDSOR_7_1, LANG_UNIVERSAL, PlayerGUID); - IsOnHold=true; - break; - case 12: - me->Say(SAY_REGINALD_WINDSOR_7_2, LANG_UNIVERSAL, PlayerGUID); - break; - case 13: - me->Say(SAY_REGINALD_WINDSOR_7_3, LANG_UNIVERSAL, PlayerGUID); - break; - case 20: - me->HandleEmoteCommand(EMOTE_STATE_POINT); - me->Say(SAY_REGINALD_WINDSOR_13_1, LANG_UNIVERSAL, PlayerGUID); - IsOnHold=true; - break; - case 21: - me->Say(SAY_REGINALD_WINDSOR_13_3, LANG_UNIVERSAL, PlayerGUID); - break; - case 23: - me->HandleEmoteCommand(EMOTE_STATE_POINT); - me->Say(SAY_REGINALD_WINDSOR_14_1, LANG_UNIVERSAL, PlayerGUID); - IsOnHold=true; - break; - case 24: - me->Say(SAY_REGINALD_WINDSOR_14_2, LANG_UNIVERSAL, PlayerGUID); - break; - case 31: - me->Say(SAY_REGINALD_WINDSOR_20_1, LANG_UNIVERSAL, PlayerGUID); - break; - case 32: - me->Say(SAY_REGINALD_WINDSOR_20_2, LANG_UNIVERSAL, PlayerGUID); - PlayerStart->GroupEventHappens(QUEST_JAIL_BREAK, me); - pInstance->SetData(DATA_SHILL, ENCOUNTER_STATE_ENDED); - break; } - } - - void MoveInLineOfSight(Unit *who) - { - if (HasEscortState(STATE_ESCORT_ESCORTING)) - return; - if (who->GetTypeId() == TYPEID_PLAYER) + void WaypointReached(uint32 i) { - if (CAST_PLR(who)->GetQuestStatus(4322) == QUEST_STATUS_INCOMPLETE) + wp=i; + switch(i) { - float Radius = 10.0; - if (me->IsWithinDistInMap(who, Radius)) - { - SetEscortPaused(false); - Start(true, false, who->GetGUID()); - } + case 0: + me->setFaction(11); + me->Say(SAY_REGINALD_WINDSOR_0_1, LANG_UNIVERSAL, PlayerGUID); + break; + case 1: + me->Say(SAY_REGINALD_WINDSOR_0_2, LANG_UNIVERSAL, PlayerGUID); + break; + case 7: + me->HandleEmoteCommand(EMOTE_STATE_POINT); + me->Say(SAY_REGINALD_WINDSOR_5_1, LANG_UNIVERSAL, PlayerGUID); + IsOnHold=true; + break; + case 8: + me->Say(SAY_REGINALD_WINDSOR_5_2, LANG_UNIVERSAL, PlayerGUID); + break; + case 11: + me->HandleEmoteCommand(EMOTE_STATE_POINT); + me->Say(SAY_REGINALD_WINDSOR_7_1, LANG_UNIVERSAL, PlayerGUID); + IsOnHold=true; + break; + case 12: + me->Say(SAY_REGINALD_WINDSOR_7_2, LANG_UNIVERSAL, PlayerGUID); + break; + case 13: + me->Say(SAY_REGINALD_WINDSOR_7_3, LANG_UNIVERSAL, PlayerGUID); + break; + case 20: + me->HandleEmoteCommand(EMOTE_STATE_POINT); + me->Say(SAY_REGINALD_WINDSOR_13_1, LANG_UNIVERSAL, PlayerGUID); + IsOnHold=true; + break; + case 21: + me->Say(SAY_REGINALD_WINDSOR_13_3, LANG_UNIVERSAL, PlayerGUID); + break; + case 23: + me->HandleEmoteCommand(EMOTE_STATE_POINT); + me->Say(SAY_REGINALD_WINDSOR_14_1, LANG_UNIVERSAL, PlayerGUID); + IsOnHold=true; + break; + case 24: + me->Say(SAY_REGINALD_WINDSOR_14_2, LANG_UNIVERSAL, PlayerGUID); + break; + case 31: + me->Say(SAY_REGINALD_WINDSOR_20_1, LANG_UNIVERSAL, PlayerGUID); + break; + case 32: + me->Say(SAY_REGINALD_WINDSOR_20_2, LANG_UNIVERSAL, PlayerGUID); + PlayerStart->GroupEventHappens(QUEST_JAIL_BREAK, me); + pInstance->SetData(DATA_SHILL, ENCOUNTER_STATE_ENDED); + break; } } - } - void EnterCombat(Unit* who) - { - switch (urand(0,2)) + void MoveInLineOfSight(Unit *who) { - case 0: me->Say(SAY_WINDSOR_AGGRO1, LANG_UNIVERSAL, PlayerGUID); break; - case 1: me->Say(SAY_WINDSOR_AGGRO2, LANG_UNIVERSAL, PlayerGUID); break; - case 2: me->Say(SAY_WINDSOR_AGGRO3, LANG_UNIVERSAL, PlayerGUID); break; - } - } - void Reset() {} - - void JustDied(Unit *slayer) - { - pInstance->SetData(DATA_QUEST_JAIL_BREAK,ENCOUNTER_STATE_FAILED); - } + if (HasEscortState(STATE_ESCORT_ESCORTING)) + return; - void UpdateAI(const uint32 diff) - { - if (pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_NOT_STARTED) return; - if (wp == 7) + if (who->GetTypeId() == TYPEID_PLAYER) { - if (!pInstance->GetData(DATA_GATE_J) && pInstance->GetData(DATA_JAZ) == ENCOUNTER_STATE_NOT_STARTED) - { - pInstance->SetData(DATA_CREATURE_JAZ,1); - pInstance->SetData(DATA_JAZ,ENCOUNTER_STATE_IN_PROGRESS); - } - if (pInstance->GetData(DATA_CREATURE_JAZ) && pInstance->GetData(DATA_CREATURE_OGRABISI) && pInstance->GetData(DATA_JAZ) == ENCOUNTER_STATE_IN_PROGRESS) + if (CAST_PLR(who)->GetQuestStatus(4322) == QUEST_STATUS_INCOMPLETE) { - SetEscortPaused(false); - pInstance->SetData(DATA_JAZ,ENCOUNTER_STATE_ENDED); + float Radius = 10.0; + if (me->IsWithinDistInMap(who, Radius)) + { + SetEscortPaused(false); + Start(true, false, who->GetGUID()); + } } } - else if (wp == 11) + } + + void EnterCombat(Unit* who) { - if (!pInstance->GetData(DATA_GATE_S) && pInstance->GetData(DATA_SHILL) == ENCOUNTER_STATE_NOT_STARTED) - { - pInstance->SetData(DATA_CREATURE_SHILL,1); - pInstance->SetData(DATA_SHILL,ENCOUNTER_STATE_IN_PROGRESS); - } - if (pInstance->GetData(DATA_CREATURE_SHILL) && pInstance->GetData(DATA_SHILL) == ENCOUNTER_STATE_IN_PROGRESS) + switch (urand(0,2)) + { + case 0: me->Say(SAY_WINDSOR_AGGRO1, LANG_UNIVERSAL, PlayerGUID); break; + case 1: me->Say(SAY_WINDSOR_AGGRO2, LANG_UNIVERSAL, PlayerGUID); break; + case 2: me->Say(SAY_WINDSOR_AGGRO3, LANG_UNIVERSAL, PlayerGUID); break; + } + } + void Reset() {} + + void JustDied(Unit *slayer) + { + pInstance->SetData(DATA_QUEST_JAIL_BREAK,ENCOUNTER_STATE_FAILED); + } + + void UpdateAI(const uint32 diff) + { + if (pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_NOT_STARTED) return; + if (wp == 7) { - pInstance->SetData(DATA_SHILL,ENCOUNTER_STATE_ENDED); - SetEscortPaused(false); + if (!pInstance->GetData(DATA_GATE_J) && pInstance->GetData(DATA_JAZ) == ENCOUNTER_STATE_NOT_STARTED) + { + pInstance->SetData(DATA_CREATURE_JAZ,1); + pInstance->SetData(DATA_JAZ,ENCOUNTER_STATE_IN_PROGRESS); + } + if (pInstance->GetData(DATA_CREATURE_JAZ) && pInstance->GetData(DATA_CREATURE_OGRABISI) && pInstance->GetData(DATA_JAZ) == ENCOUNTER_STATE_IN_PROGRESS) + { + SetEscortPaused(false); + pInstance->SetData(DATA_JAZ,ENCOUNTER_STATE_ENDED); + } } - } - else if (wp == 20) - { - if (!pInstance->GetData(DATA_GATE_C) && pInstance->GetData(DATA_CREST) == ENCOUNTER_STATE_NOT_STARTED) + else if (wp == 11) { - pInstance->SetData(DATA_CREATURE_CREST,1); - me->Say(SAY_REGINALD_WINDSOR_13_2, LANG_UNIVERSAL, PlayerGUID); - pInstance->SetData(DATA_CREST,ENCOUNTER_STATE_IN_PROGRESS); + if (!pInstance->GetData(DATA_GATE_S) && pInstance->GetData(DATA_SHILL) == ENCOUNTER_STATE_NOT_STARTED) + { + pInstance->SetData(DATA_CREATURE_SHILL,1); + pInstance->SetData(DATA_SHILL,ENCOUNTER_STATE_IN_PROGRESS); + } + if (pInstance->GetData(DATA_CREATURE_SHILL) && pInstance->GetData(DATA_SHILL) == ENCOUNTER_STATE_IN_PROGRESS) + { + pInstance->SetData(DATA_SHILL,ENCOUNTER_STATE_ENDED); + SetEscortPaused(false); + } } - if (pInstance->GetData(DATA_CREATURE_CREST) && pInstance->GetData(DATA_CREST) == ENCOUNTER_STATE_IN_PROGRESS) + else if (wp == 20) { - SetEscortPaused(false); - pInstance->SetData(DATA_CREST,ENCOUNTER_STATE_ENDED); + if (!pInstance->GetData(DATA_GATE_C) && pInstance->GetData(DATA_CREST) == ENCOUNTER_STATE_NOT_STARTED) + { + pInstance->SetData(DATA_CREATURE_CREST,1); + me->Say(SAY_REGINALD_WINDSOR_13_2, LANG_UNIVERSAL, PlayerGUID); + pInstance->SetData(DATA_CREST,ENCOUNTER_STATE_IN_PROGRESS); + } + if (pInstance->GetData(DATA_CREATURE_CREST) && pInstance->GetData(DATA_CREST) == ENCOUNTER_STATE_IN_PROGRESS) + { + SetEscortPaused(false); + pInstance->SetData(DATA_CREST,ENCOUNTER_STATE_ENDED); + } } - } - if (pInstance->GetData(DATA_TOBIAS) == ENCOUNTER_STATE_OBJECTIVE_COMPLETED) SetEscortPaused(false); - npc_escortAI::UpdateAI(diff); - } + if (pInstance->GetData(DATA_TOBIAS) == ENCOUNTER_STATE_OBJECTIVE_COMPLETED) SetEscortPaused(false); + npc_escortAI::UpdateAI(diff); + } + }; + }; -CreatureAI* GetAI_npc_marshal_reginald_windsor(Creature* pCreature) -{ - npc_marshal_reginald_windsorAI* marshal_reginald_windsorAI = new npc_marshal_reginald_windsorAI(pCreature); - - marshal_reginald_windsorAI->AddWaypoint(0, 403.61,-52.71, -63.92,4000); - marshal_reginald_windsorAI->AddWaypoint(1, 403.61,-52.71, -63.92,4000); - marshal_reginald_windsorAI->AddWaypoint(2, 406.33,-54.87, -63.95,0); - marshal_reginald_windsorAI->AddWaypoint(3, 407.99,-73.91, -62.26,0); - marshal_reginald_windsorAI->AddWaypoint(4, 557.03,-119.71, -61.83,0); - marshal_reginald_windsorAI->AddWaypoint(5, 573.40,-124.39, -65.07,0); - marshal_reginald_windsorAI->AddWaypoint(6, 593.91,-130.29, -69.25,0); - marshal_reginald_windsorAI->AddWaypoint(7, 593.21,-132.16, -69.25,0); - marshal_reginald_windsorAI->AddWaypoint(8, 593.21,-132.16, -69.25,3000); - marshal_reginald_windsorAI->AddWaypoint(9, 622.81,-135.55, -71.92,0); - marshal_reginald_windsorAI->AddWaypoint(10, 634.68,-151.29, -70.32,0); - marshal_reginald_windsorAI->AddWaypoint(11, 635.06,-153.25, -70.32,0); - marshal_reginald_windsorAI->AddWaypoint(12, 635.06,-153.25, -70.32,3000); - marshal_reginald_windsorAI->AddWaypoint(13, 635.06,-153.25, -70.32,1500); - marshal_reginald_windsorAI->AddWaypoint(14, 655.25,-172.39, -73.72,0); - marshal_reginald_windsorAI->AddWaypoint(15, 654.79,-226.30, -83.06,0); - marshal_reginald_windsorAI->AddWaypoint(16, 622.85,-268.85, -83.96,0); - marshal_reginald_windsorAI->AddWaypoint(17, 579.45,-275.56, -80.44,0); - marshal_reginald_windsorAI->AddWaypoint(18, 561.19,-266.85, -75.59,0); - marshal_reginald_windsorAI->AddWaypoint(19, 547.91,-253.92, -70.34,0); - marshal_reginald_windsorAI->AddWaypoint(20, 549.20,-252.40, -70.34,0); - marshal_reginald_windsorAI->AddWaypoint(21, 549.20,-252.40, -70.34,4000); - marshal_reginald_windsorAI->AddWaypoint(22, 555.33,-269.16, -74.40,0); - marshal_reginald_windsorAI->AddWaypoint(23, 554.31,-270.88, -74.40,0); - marshal_reginald_windsorAI->AddWaypoint(24, 554.31,-270.88, -74.40,4000); - marshal_reginald_windsorAI->AddWaypoint(25, 536.10,-249.60, -67.47,0); - marshal_reginald_windsorAI->AddWaypoint(26, 520.94,-216.65, -59.28,0); - marshal_reginald_windsorAI->AddWaypoint(27, 505.99,-148.74, -62.17,0); - marshal_reginald_windsorAI->AddWaypoint(28, 484.21,-56.24, -62.43,0); - marshal_reginald_windsorAI->AddWaypoint(29, 470.39,-6.01, -70.10,0); - marshal_reginald_windsorAI->AddWaypoint(30, 451.27,30.85, -70.07,0); - marshal_reginald_windsorAI->AddWaypoint(31, 452.45,29.85, -70.37,1500); - marshal_reginald_windsorAI->AddWaypoint(32, 452.45,29.85, -70.37,7000); - marshal_reginald_windsorAI->AddWaypoint(33, 452.45,29.85, -70.37,10000); - marshal_reginald_windsorAI->AddWaypoint(34, 451.27,31.85, -70.07,0); - - return marshal_reginald_windsorAI; -} */ /*###### ## npc_tobias_seecher ######*/ #define SAY_TOBIAS_FREE "Thank you! I will run for safety immediately!" -/* -struct npc_tobias_seecherAI : public npc_escortAI +/*
class npc_tobias_seecher : public CreatureScript { - npc_tobias_seecherAI(Creature *c) :npc_escortAI(c) {} +public: + npc_tobias_seecher() : CreatureScript("npc_tobias_seecher") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + npc_tobias_seecherAI* tobias_seecherAI = new npc_tobias_seecherAI(pCreature); + + tobias_seecherAI->AddWaypoint(0, 549.21, -281.07, -75.27); + tobias_seecherAI->AddWaypoint(1, 554.39, -267.39, -73.68); + tobias_seecherAI->AddWaypoint(2, 533.59, -249.38, -67.04); + tobias_seecherAI->AddWaypoint(3, 519.44, -217.02, -59.34); + tobias_seecherAI->AddWaypoint(4, 506.55, -153.49, -62.34); - void EnterCombat(Unit* who) {} - void Reset() {} + return tobias_seecherAI; + } - void JustDied(Unit* killer) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { - if (IsBeingEscorted && killer == me) + if (uiAction == GOSSIP_ACTION_INFO_DEF + 1) { - me->SetVisibility(VISIBILITY_OFF); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - pInstance->SetData(DATA_TOBIAS,ENCOUNTER_STATE_ENDED); + pPlayer->CLOSE_GOSSIP_MENU(); + CAST_AI(npc_escort::npc_escortAI, (pCreature->AI()))->Start(false, true, pPlayer->GetGUID()); + pCreature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + pInstance->SetData(DATA_TOBIAS,ENCOUNTER_STATE_IN_PROGRESS); } + return true; } - void WaypointReached(uint32 i) + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - switch(i) + if (pPlayer->GetQuestStatus(QUEST_JAIL_BREAK) == QUEST_STATUS_INCOMPLETE && pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_IN_PROGRESS) { - case 0:me->Say(SAY_TOBIAS_FREE, LANG_UNIVERSAL, PlayerGUID); break; - case 2: - pInstance->SetData(DATA_TOBIAS,ENCOUNTER_STATE_OBJECTIVE_COMPLETED);break; - case 4: - me->SetVisibility(VISIBILITY_OFF); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - pInstance->SetData(DATA_TOBIAS,ENCOUNTER_STATE_ENDED); - break; + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Get out of here, Tobias, you're free!", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + pPlayer->SEND_GOSSIP_MENU(2847, pCreature->GetGUID()); } + return true; } - void UpdateAI(const uint32 diff) + struct npc_tobias_seecherAI : public npc_escortAI { - if (pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_NOT_STARTED) return; - if ((pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_IN_PROGRESS || pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_FAILED || pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_ENDED)&& pInstance->GetData(DATA_TOBIAS) == ENCOUNTER_STATE_ENDED) + npc_tobias_seecherAI(Creature *c) :npc_escortAI(c) {} + + void EnterCombat(Unit* who) {} + void Reset() {} + + void JustDied(Unit* killer) { - me->SetVisibility(VISIBILITY_OFF); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + if (IsBeingEscorted && killer == me) + { + me->SetVisibility(VISIBILITY_OFF); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + pInstance->SetData(DATA_TOBIAS,ENCOUNTER_STATE_ENDED); + } } - else + + void WaypointReached(uint32 i) { - me->SetVisibility(VISIBILITY_ON); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + switch(i) + { + case 0:me->Say(SAY_TOBIAS_FREE, LANG_UNIVERSAL, PlayerGUID); break; + case 2: + pInstance->SetData(DATA_TOBIAS,ENCOUNTER_STATE_OBJECTIVE_COMPLETED);break; + case 4: + me->SetVisibility(VISIBILITY_OFF); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + pInstance->SetData(DATA_TOBIAS,ENCOUNTER_STATE_ENDED); + break; + } } - npc_escortAI::UpdateAI(diff); - } -}; -CreatureAI* GetAI_npc_tobias_seecher(Creature* pCreature) -{ - npc_tobias_seecherAI* tobias_seecherAI = new npc_tobias_seecherAI(pCreature); + void UpdateAI(const uint32 diff) + { + if (pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_NOT_STARTED) return; + if ((pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_IN_PROGRESS || pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_FAILED || pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_ENDED)&& pInstance->GetData(DATA_TOBIAS) == ENCOUNTER_STATE_ENDED) + { + me->SetVisibility(VISIBILITY_OFF); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + } + else + { + me->SetVisibility(VISIBILITY_ON); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + } + npc_escortAI::UpdateAI(diff); + } + }; - tobias_seecherAI->AddWaypoint(0, 549.21, -281.07, -75.27); - tobias_seecherAI->AddWaypoint(1, 554.39, -267.39, -73.68); - tobias_seecherAI->AddWaypoint(2, 533.59, -249.38, -67.04); - tobias_seecherAI->AddWaypoint(3, 519.44, -217.02, -59.34); - tobias_seecherAI->AddWaypoint(4, 506.55, -153.49, -62.34); +}; - return tobias_seecherAI; -} -bool GossipHello_npc_tobias_seecher(Player* pPlayer, Creature* pCreature) -{ - if (pPlayer->GetQuestStatus(QUEST_JAIL_BREAK) == QUEST_STATUS_INCOMPLETE && pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_IN_PROGRESS) - { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Get out of here, Tobias, you're free!", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - pPlayer->SEND_GOSSIP_MENU(2847, pCreature->GetGUID()); - } - return true; -} -bool GossipSelect_npc_tobias_seecher(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF + 1) - { - pPlayer->CLOSE_GOSSIP_MENU(); - CAST_AI(npc_escortAI, (pCreature->AI()))->Start(false, true, pPlayer->GetGUID()); - pCreature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - pInstance->SetData(DATA_TOBIAS,ENCOUNTER_STATE_IN_PROGRESS); - } - return true; -} */ /*###### @@ -1138,132 +1211,138 @@ enum RocknotQuests { QUEST_ALE = 4295 }; - -struct npc_rocknotAI : public npc_escortAI +
class npc_rocknot : public CreatureScript { - npc_rocknotAI(Creature *c) : npc_escortAI(c) +public: + npc_rocknot() : CreatureScript("npc_rocknot") { } + + bool ChooseReward(Player* /*pPlayer*/, Creature* pCreature, const Quest *_Quest, uint32 /*item*/) { - pInstance = c->GetInstanceData(); - } + InstanceScript* pInstance = pCreature->GetInstanceScript(); - ScriptedInstance* pInstance; + if (!pInstance) + return true; - uint32 BreakKeg_Timer; - uint32 BreakDoor_Timer; + if (pInstance->GetData(TYPE_BAR) == DONE || pInstance->GetData(TYPE_BAR) == SPECIAL) + return true; - void Reset() - { - if (HasEscortState(STATE_ESCORT_ESCORTING)) - return; + if (_Quest->GetQuestId() == QUEST_ALE) + { + if (pInstance->GetData(TYPE_BAR) != IN_PROGRESS) + pInstance->SetData(TYPE_BAR,IN_PROGRESS); + + pInstance->SetData(TYPE_BAR,SPECIAL); + + //keep track of amount in instance script, returns SPECIAL if amount ok and event in progress + if (pInstance->GetData(TYPE_BAR) == SPECIAL) + { + DoScriptText(SAY_GOT_BEER, pCreature); + pCreature->CastSpell(pCreature,SPELL_DRUNKEN_RAGE,false); + if (npc_escortAI* pEscortAI = CAST_AI(npc_rocknot::npc_rocknotAI, pCreature->AI())) + pEscortAI->Start(false, false); + } + } - BreakKeg_Timer = 0; - BreakDoor_Timer = 0; + return true; } - void DoGo(uint32 id, uint32 state) + CreatureAI* GetAI(Creature* pCreature) const { - if (GameObject* pGo = pInstance->instance->GetGameObject(pInstance->GetData64(id))) - pGo->SetGoState((GOState)state); + return new npc_rocknotAI(pCreature); } - void WaypointReached(uint32 i) + struct npc_rocknotAI : public npc_escortAI { - if (!pInstance) - return; - - switch(i) + npc_rocknotAI(Creature *c) : npc_escortAI(c) { - case 1: - me->HandleEmoteCommand(EMOTE_ONESHOT_KICK); - break; - case 2: - me->HandleEmoteCommand(EMOTE_ONESHOT_ATTACKUNARMED); - break; - case 3: - me->HandleEmoteCommand(EMOTE_ONESHOT_ATTACKUNARMED); - break; - case 4: - me->HandleEmoteCommand(EMOTE_ONESHOT_KICK); - break; - case 5: - me->HandleEmoteCommand(EMOTE_ONESHOT_KICK); - BreakKeg_Timer = 2000; - break; + pInstance = c->GetInstanceScript(); } - } - void UpdateAI(const uint32 diff) - { - if (!pInstance) - return; + InstanceScript* pInstance; - if (BreakKeg_Timer) + uint32 BreakKeg_Timer; + uint32 BreakDoor_Timer; + + void Reset() { - if (BreakKeg_Timer <= diff) - { - DoGo(DATA_GO_BAR_KEG,0); - BreakKeg_Timer = 0; - BreakDoor_Timer = 1000; - } else BreakKeg_Timer -= diff; + if (HasEscortState(STATE_ESCORT_ESCORTING)) + return; + + BreakKeg_Timer = 0; + BreakDoor_Timer = 0; } - if (BreakDoor_Timer) + void DoGo(uint32 id, uint32 state) { - if (BreakDoor_Timer <= diff) - { - DoGo(DATA_GO_BAR_DOOR,2); - DoGo(DATA_GO_BAR_KEG_TRAP,0); //doesn't work very well, leaving code here for future - //spell by trap has effect61, this indicate the bar go hostile - - if (Unit *tmp = Unit::GetUnit(*me,pInstance->GetData64(DATA_PHALANX))) - tmp->setFaction(14); + if (GameObject* pGo = pInstance->instance->GetGameObject(pInstance->GetData64(id))) + pGo->SetGoState((GOState)state); + } - //for later, this event(s) has alot more to it. - //optionally, DONE can trigger bar to go hostile. - pInstance->SetData(TYPE_BAR,DONE); + void WaypointReached(uint32 i) + { + if (!pInstance) + return; - BreakDoor_Timer = 0; - } else BreakDoor_Timer -= diff; + switch(i) + { + case 1: + me->HandleEmoteCommand(EMOTE_ONESHOT_KICK); + break; + case 2: + me->HandleEmoteCommand(EMOTE_ONESHOT_ATTACKUNARMED); + break; + case 3: + me->HandleEmoteCommand(EMOTE_ONESHOT_ATTACKUNARMED); + break; + case 4: + me->HandleEmoteCommand(EMOTE_ONESHOT_KICK); + break; + case 5: + me->HandleEmoteCommand(EMOTE_ONESHOT_KICK); + BreakKeg_Timer = 2000; + break; + } } - npc_escortAI::UpdateAI(diff); - } -}; - -CreatureAI* GetAI_npc_rocknot(Creature* pCreature) -{ - return new npc_rocknotAI(pCreature); -} + void UpdateAI(const uint32 diff) + { + if (!pInstance) + return; -bool ChooseReward_npc_rocknot(Player* /*pPlayer*/, Creature* pCreature, const Quest *_Quest, uint32 /*item*/) -{ - ScriptedInstance* pInstance = pCreature->GetInstanceData(); + if (BreakKeg_Timer) + { + if (BreakKeg_Timer <= diff) + { + DoGo(DATA_GO_BAR_KEG,0); + BreakKeg_Timer = 0; + BreakDoor_Timer = 1000; + } else BreakKeg_Timer -= diff; + } - if (!pInstance) - return true; + if (BreakDoor_Timer) + { + if (BreakDoor_Timer <= diff) + { + DoGo(DATA_GO_BAR_DOOR,2); + DoGo(DATA_GO_BAR_KEG_TRAP,0); //doesn't work very well, leaving code here for future + //spell by trap has effect61, this indicate the bar go hostile - if (pInstance->GetData(TYPE_BAR) == DONE || pInstance->GetData(TYPE_BAR) == SPECIAL) - return true; + if (Unit *tmp = Unit::GetUnit(*me,pInstance->GetData64(DATA_PHALANX))) + tmp->setFaction(14); - if (_Quest->GetQuestId() == QUEST_ALE) - { - if (pInstance->GetData(TYPE_BAR) != IN_PROGRESS) - pInstance->SetData(TYPE_BAR,IN_PROGRESS); + //for later, this event(s) has alot more to it. + //optionally, DONE can trigger bar to go hostile. + pInstance->SetData(TYPE_BAR,DONE); - pInstance->SetData(TYPE_BAR,SPECIAL); + BreakDoor_Timer = 0; + } else BreakDoor_Timer -= diff; + } - //keep track of amount in instance script, returns SPECIAL if amount ok and event in progress - if (pInstance->GetData(TYPE_BAR) == SPECIAL) - { - DoScriptText(SAY_GOT_BEER, pCreature); - pCreature->CastSpell(pCreature,SPELL_DRUNKEN_RAGE,false); - if (npc_escortAI* pEscortAI = CAST_AI(npc_rocknotAI, pCreature->AI())) - pEscortAI->Start(false, false); + npc_escortAI::UpdateAI(diff); } - } + }; - return true; -} +}; /*###### ## @@ -1271,68 +1350,15 @@ bool ChooseReward_npc_rocknot(Player* /*pPlayer*/, Creature* pCreature, const Qu void AddSC_blackrock_depths() { - Script *newscript; - - newscript = new Script; - newscript->Name = "go_shadowforge_brazier"; - newscript->pGOHello = &GOHello_go_shadowforge_brazier; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "at_ring_of_law"; - newscript->pAreaTrigger = &AreaTrigger_at_ring_of_law; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_grimstone"; - newscript->GetAI = &GetAI_npc_grimstone; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_phalanx"; - newscript->GetAI = &GetAI_mob_phalanx; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_kharan_mighthammer"; - newscript->pGossipHello = &GossipHello_npc_kharan_mighthammer; - newscript->pGossipSelect = &GossipSelect_npc_kharan_mighthammer; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_lokhtos_darkbargainer"; - newscript->pGossipHello = &GossipHello_npc_lokhtos_darkbargainer; - newscript->pGossipSelect = &GossipSelect_npc_lokhtos_darkbargainer; - newscript->RegisterSelf(); -/* - newscript = new Script; - newscript->Name = "npc_dughal_stormwing"; - newscript->pGossipHello = &GossipHello_npc_dughal_stormwing; - newscript->pGossipSelect = &GossipSelect_npc_dughal_stormwing; - newscript->GetAI = &GetAI_npc_dughal_stormwing; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_tobias_seecher"; - newscript->pGossipHello = &GossipHello_npc_tobias_seecher; - newscript->pGossipSelect = &GossipSelect_npc_tobias_seecher; - newscript->GetAI = &GetAI_npc_tobias_seecher; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_marshal_windsor"; - newscript->pQuestAccept = &QuestAccept_npc_marshal_windsor; - newscript->GetAI = &GetAI_npc_marshal_windsor; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_marshal_reginald_windsor"; - newscript->GetAI = &GetAI_npc_marshal_reginald_windsor; - newscript->RegisterSelf(); -*/ - newscript = new Script; - newscript->Name = "npc_rocknot"; - newscript->GetAI = &GetAI_npc_rocknot; - newscript->pChooseReward = &ChooseReward_npc_rocknot; - newscript->RegisterSelf(); + new go_shadowforge_brazier(); + new at_ring_of_law(); + new npc_grimstone(); + new mob_phalanx(); + new npc_kharan_mighthammer(); + new npc_lokhtos_darkbargainer(); + new npc_dughal_stormwing(); + new npc_tobias_seecher(); + new npc_marshal_windsor(); + new npc_marshal_reginald_windsor(); + new npc_rocknot(); } diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_ambassador_flamelash.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_ambassador_flamelash.cpp index df77770a410..70a9e3b1ef3 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_ambassador_flamelash.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_ambassador_flamelash.cpp @@ -29,65 +29,68 @@ enum Spells { SPELL_FIREBLAST = 15573 }; - -struct boss_ambassador_flamelashAI : public ScriptedAI +
class boss_ambassador_flamelash : public CreatureScript { - boss_ambassador_flamelashAI(Creature *c) : ScriptedAI(c) {} - - uint32 FireBlast_Timer; - uint32 Spirit_Timer; +public: + boss_ambassador_flamelash() : CreatureScript("boss_ambassador_flamelash") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - FireBlast_Timer = 2000; - Spirit_Timer = 24000; + return new boss_ambassador_flamelashAI (pCreature); } - void EnterCombat(Unit * /*who*/) {} - - void SummonSpirits(Unit* victim) + struct boss_ambassador_flamelashAI : public ScriptedAI { - if (Creature *Spirit = DoSpawnCreature(9178, irand(-9,9), irand(-9,9), 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 60000)) - Spirit->AI()->AttackStart(victim); - } + boss_ambassador_flamelashAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + uint32 FireBlast_Timer; + uint32 Spirit_Timer; + + void Reset() + { + FireBlast_Timer = 2000; + Spirit_Timer = 24000; + } - //FireBlast_Timer - if (FireBlast_Timer <= diff) + void EnterCombat(Unit * /*who*/) {} + + void SummonSpirits(Unit* victim) { - DoCast(me->getVictim(), SPELL_FIREBLAST); - FireBlast_Timer = 7000; - } else FireBlast_Timer -= diff; + if (Creature *Spirit = DoSpawnCreature(9178, irand(-9,9), irand(-9,9), 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 60000)) + Spirit->AI()->AttackStart(victim); + } - //Spirit_Timer - if (Spirit_Timer <= diff) + void UpdateAI(const uint32 diff) { - SummonSpirits(me->getVictim()); - SummonSpirits(me->getVictim()); - SummonSpirits(me->getVictim()); - SummonSpirits(me->getVictim()); + //Return since we have no target + if (!UpdateVictim()) + return; - Spirit_Timer = 30000; - } else Spirit_Timer -= diff; + //FireBlast_Timer + if (FireBlast_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_FIREBLAST); + FireBlast_Timer = 7000; + } else FireBlast_Timer -= diff; + + //Spirit_Timer + if (Spirit_Timer <= diff) + { + SummonSpirits(me->getVictim()); + SummonSpirits(me->getVictim()); + SummonSpirits(me->getVictim()); + SummonSpirits(me->getVictim()); + + Spirit_Timer = 30000; + } else Spirit_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_ambassador_flamelash(Creature* pCreature) -{ - return new boss_ambassador_flamelashAI (pCreature); -} void AddSC_boss_ambassador_flamelash() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_ambassador_flamelash"; - newscript->GetAI = &GetAI_boss_ambassador_flamelash; - newscript->RegisterSelf(); + new boss_ambassador_flamelash(); } diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_anubshiah.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_anubshiah.cpp index e8277d9e931..b3aabeee20d 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_anubshiah.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_anubshiah.cpp @@ -33,86 +33,89 @@ enum Spells SPELL_DEMONARMOR = 11735, SPELL_ENVELOPINGWEB = 15471 }; - -struct boss_anubshiahAI : public ScriptedAI +
class boss_anubshiah : public CreatureScript { - boss_anubshiahAI(Creature *c) : ScriptedAI(c) {} - - uint32 ShadowBolt_Timer; - uint32 CurseOfTongues_Timer; - uint32 CurseOfWeakness_Timer; - uint32 DemonArmor_Timer; - uint32 EnvelopingWeb_Timer; +public: + boss_anubshiah() : CreatureScript("boss_anubshiah") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - ShadowBolt_Timer = 7000; - CurseOfTongues_Timer = 24000; - CurseOfWeakness_Timer = 12000; - DemonArmor_Timer = 3000; - EnvelopingWeb_Timer = 16000; + return new boss_anubshiahAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_anubshiahAI : public ScriptedAI { - } + boss_anubshiahAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + uint32 ShadowBolt_Timer; + uint32 CurseOfTongues_Timer; + uint32 CurseOfWeakness_Timer; + uint32 DemonArmor_Timer; + uint32 EnvelopingWeb_Timer; - //ShadowBolt_Timer - if (ShadowBolt_Timer <= diff) + void Reset() { - DoCast(me->getVictim(), SPELL_SHADOWBOLT); ShadowBolt_Timer = 7000; - } else ShadowBolt_Timer -= diff; + CurseOfTongues_Timer = 24000; + CurseOfWeakness_Timer = 12000; + DemonArmor_Timer = 3000; + EnvelopingWeb_Timer = 16000; + } - //CurseOfTongues_Timer - if (CurseOfTongues_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(pTarget, SPELL_CURSEOFTONGUES); - CurseOfTongues_Timer = 18000; - } else CurseOfTongues_Timer -= diff; + } - //CurseOfWeakness_Timer - if (CurseOfWeakness_Timer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_CURSEOFWEAKNESS); - CurseOfWeakness_Timer = 45000; - } else CurseOfWeakness_Timer -= diff; + //Return since we have no target + if (!UpdateVictim()) + return; - //DemonArmor_Timer - if (DemonArmor_Timer <= diff) - { - DoCast(me, SPELL_DEMONARMOR); - DemonArmor_Timer = 300000; - } else DemonArmor_Timer -= diff; + //ShadowBolt_Timer + if (ShadowBolt_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_SHADOWBOLT); + ShadowBolt_Timer = 7000; + } else ShadowBolt_Timer -= diff; - //EnvelopingWeb_Timer - if (EnvelopingWeb_Timer <= diff) - { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(pTarget, SPELL_ENVELOPINGWEB); - EnvelopingWeb_Timer = 12000; - } else EnvelopingWeb_Timer -= diff; + //CurseOfTongues_Timer + if (CurseOfTongues_Timer <= diff) + { + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + DoCast(pTarget, SPELL_CURSEOFTONGUES); + CurseOfTongues_Timer = 18000; + } else CurseOfTongues_Timer -= diff; + + //CurseOfWeakness_Timer + if (CurseOfWeakness_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_CURSEOFWEAKNESS); + CurseOfWeakness_Timer = 45000; + } else CurseOfWeakness_Timer -= diff; + + //DemonArmor_Timer + if (DemonArmor_Timer <= diff) + { + DoCast(me, SPELL_DEMONARMOR); + DemonArmor_Timer = 300000; + } else DemonArmor_Timer -= diff; + + //EnvelopingWeb_Timer + if (EnvelopingWeb_Timer <= diff) + { + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + DoCast(pTarget, SPELL_ENVELOPINGWEB); + EnvelopingWeb_Timer = 12000; + } else EnvelopingWeb_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_anubshiah(Creature* pCreature) -{ - return new boss_anubshiahAI (pCreature); -} void AddSC_boss_anubshiah() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_anubshiah"; - newscript->GetAI = &GetAI_boss_anubshiah; - newscript->RegisterSelf(); + new boss_anubshiah(); } diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_emperor_dagran_thaurissan.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_emperor_dagran_thaurissan.cpp index d177e3c97ac..83722d057bd 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_emperor_dagran_thaurissan.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_emperor_dagran_thaurissan.cpp @@ -36,78 +36,81 @@ enum Spells SPELL_HANDOFTHAURISSAN = 17492, SPELL_AVATAROFFLAME = 15636 }; - -struct boss_draganthaurissanAI : public ScriptedAI +
class boss_emperor_dagran_thaurissan : public CreatureScript { - boss_draganthaurissanAI(Creature *c) : ScriptedAI(c) {} - - uint32 HandOfThaurissan_Timer; - uint32 AvatarOfFlame_Timer; - //uint32 Counter; +public: + boss_emperor_dagran_thaurissan() : CreatureScript("boss_emperor_dagran_thaurissan") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - HandOfThaurissan_Timer = 4000; - AvatarOfFlame_Timer = 25000; - //Counter= 0; + return new boss_draganthaurissanAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_draganthaurissanAI : public ScriptedAI { - DoScriptText(SAY_AGGRO, me); - me->CallForHelp(VISIBLE_RANGE); - } + boss_draganthaurissanAI(Creature *c) : ScriptedAI(c) {} - void KilledUnit(Unit* /*victim*/) - { - DoScriptText(SAY_SLAY, me); - } + uint32 HandOfThaurissan_Timer; + uint32 AvatarOfFlame_Timer; + //uint32 Counter; - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + void Reset() + { + HandOfThaurissan_Timer = 4000; + AvatarOfFlame_Timer = 25000; + //Counter= 0; + } - if (HandOfThaurissan_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) - DoCast(pTarget, SPELL_HANDOFTHAURISSAN); - - //3 Hands of Thaurissan will be casted - //if (Counter < 3) - //{ - // HandOfThaurissan_Timer = 1000; - // ++Counter; - //} - //else - //{ - HandOfThaurissan_Timer = 5000; - //Counter = 0; - //} - } else HandOfThaurissan_Timer -= diff; - - //AvatarOfFlame_Timer - if (AvatarOfFlame_Timer <= diff) + DoScriptText(SAY_AGGRO, me); + me->CallForHelp(VISIBLE_RANGE); + } + + void KilledUnit(Unit* /*victim*/) { - DoCast(me->getVictim(), SPELL_AVATAROFFLAME); - AvatarOfFlame_Timer = 18000; - } else AvatarOfFlame_Timer -= diff; + DoScriptText(SAY_SLAY, me); + } + + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + if (HandOfThaurissan_Timer <= diff) + { + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + DoCast(pTarget, SPELL_HANDOFTHAURISSAN); + + //3 Hands of Thaurissan will be casted + //if (Counter < 3) + //{ + // HandOfThaurissan_Timer = 1000; + // ++Counter; + //} + //else + //{ + HandOfThaurissan_Timer = 5000; + //Counter = 0; + //} + } else HandOfThaurissan_Timer -= diff; + + //AvatarOfFlame_Timer + if (AvatarOfFlame_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_AVATAROFFLAME); + AvatarOfFlame_Timer = 18000; + } else AvatarOfFlame_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_draganthaurissan(Creature* pCreature) -{ - return new boss_draganthaurissanAI (pCreature); -} void AddSC_boss_draganthaurissan() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_emperor_dagran_thaurissan"; - newscript->GetAI = &GetAI_boss_draganthaurissan; - newscript->RegisterSelf(); + new boss_emperor_dagran_thaurissan(); } diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_general_angerforge.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_general_angerforge.cpp index 0c50893633b..407bf26b005 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_general_angerforge.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_general_angerforge.cpp @@ -31,104 +31,107 @@ enum Spells SPELL_HAMSTRING = 9080, SPELL_CLEAVE = 20691 }; - -struct boss_general_angerforgeAI : public ScriptedAI +
class boss_general_angerforge : public CreatureScript { - boss_general_angerforgeAI(Creature *c) : ScriptedAI(c) {} - - uint32 MightyBlow_Timer; - uint32 HamString_Timer; - uint32 Cleave_Timer; - uint32 Adds_Timer; - bool Medics; +public: + boss_general_angerforge() : CreatureScript("boss_general_angerforge") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - MightyBlow_Timer = 8000; - HamString_Timer = 12000; - Cleave_Timer = 16000; - Adds_Timer = 0; - Medics = false; + return new boss_general_angerforgeAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_general_angerforgeAI : public ScriptedAI { - } + boss_general_angerforgeAI(Creature *c) : ScriptedAI(c) {} - void SummonAdds(Unit* victim) - { - if (Creature *SummonedAdd = DoSpawnCreature(8901, irand(-14,14), irand(-14,14), 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 120000)) - SummonedAdd->AI()->AttackStart(victim); - } + uint32 MightyBlow_Timer; + uint32 HamString_Timer; + uint32 Cleave_Timer; + uint32 Adds_Timer; + bool Medics; - void SummonMedics(Unit* victim) - { - if (Creature *SummonedMedic = DoSpawnCreature(8894, irand(-9,9), irand(-9,9), 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 120000)) - SummonedMedic->AI()->AttackStart(victim); - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + void Reset() + { + MightyBlow_Timer = 8000; + HamString_Timer = 12000; + Cleave_Timer = 16000; + Adds_Timer = 0; + Medics = false; + } - //MightyBlow_Timer - if (MightyBlow_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - DoCast(me->getVictim(), SPELL_MIGHTYBLOW); - MightyBlow_Timer = 18000; - } else MightyBlow_Timer -= diff; + } - //HamString_Timer - if (HamString_Timer <= diff) + void SummonAdds(Unit* victim) { - DoCast(me->getVictim(), SPELL_HAMSTRING); - HamString_Timer = 15000; - } else HamString_Timer -= diff; + if (Creature *SummonedAdd = DoSpawnCreature(8901, irand(-14,14), irand(-14,14), 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 120000)) + SummonedAdd->AI()->AttackStart(victim); + } - //Cleave_Timer - if (Cleave_Timer <= diff) + void SummonMedics(Unit* victim) { - DoCast(me->getVictim(), SPELL_CLEAVE); - Cleave_Timer = 9000; - } else Cleave_Timer -= diff; + if (Creature *SummonedMedic = DoSpawnCreature(8894, irand(-9,9), irand(-9,9), 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 120000)) + SummonedMedic->AI()->AttackStart(victim); + } - //Adds_Timer - if (me->GetHealth()*100 / me->GetMaxHealth() < 21) + void UpdateAI(const uint32 diff) { - if (Adds_Timer <= diff) + //Return since we have no target + if (!UpdateVictim()) + return; + + //MightyBlow_Timer + if (MightyBlow_Timer <= diff) { - // summon 3 Adds every 25s - SummonAdds(me->getVictim()); - SummonAdds(me->getVictim()); - SummonAdds(me->getVictim()); + DoCast(me->getVictim(), SPELL_MIGHTYBLOW); + MightyBlow_Timer = 18000; + } else MightyBlow_Timer -= diff; - Adds_Timer = 25000; - } else Adds_Timer -= diff; - } + //HamString_Timer + if (HamString_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_HAMSTRING); + HamString_Timer = 15000; + } else HamString_Timer -= diff; - //Summon Medics - if (!Medics && me->GetHealth()*100 / me->GetMaxHealth() < 21) - { - SummonMedics(me->getVictim()); - SummonMedics(me->getVictim()); - Medics = true; + //Cleave_Timer + if (Cleave_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_CLEAVE); + Cleave_Timer = 9000; + } else Cleave_Timer -= diff; + + //Adds_Timer + if (me->GetHealth()*100 / me->GetMaxHealth() < 21) + { + if (Adds_Timer <= diff) + { + // summon 3 Adds every 25s + SummonAdds(me->getVictim()); + SummonAdds(me->getVictim()); + SummonAdds(me->getVictim()); + + Adds_Timer = 25000; + } else Adds_Timer -= diff; + } + + //Summon Medics + if (!Medics && me->GetHealth()*100 / me->GetMaxHealth() < 21) + { + SummonMedics(me->getVictim()); + SummonMedics(me->getVictim()); + Medics = true; + } + + DoMeleeAttackIfReady(); } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_general_angerforge(Creature* pCreature) -{ - return new boss_general_angerforgeAI (pCreature); -} void AddSC_boss_general_angerforge() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_general_angerforge"; - newscript->GetAI = &GetAI_boss_general_angerforge; - newscript->RegisterSelf(); + new boss_general_angerforge(); } diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_gorosh_the_dervish.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_gorosh_the_dervish.cpp index 718278d3720..12465f77955 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_gorosh_the_dervish.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_gorosh_the_dervish.cpp @@ -30,57 +30,60 @@ enum Spells SPELL_WHIRLWIND = 15589, SPELL_MORTALSTRIKE = 24573 }; - -struct boss_gorosh_the_dervishAI : public ScriptedAI +
class boss_gorosh_the_dervish : public CreatureScript { - boss_gorosh_the_dervishAI(Creature *c) : ScriptedAI(c) {} - - uint32 WhirlWind_Timer; - uint32 MortalStrike_Timer; +public: + boss_gorosh_the_dervish() : CreatureScript("boss_gorosh_the_dervish") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - WhirlWind_Timer = 12000; - MortalStrike_Timer = 22000; + return new boss_gorosh_the_dervishAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_gorosh_the_dervishAI : public ScriptedAI { - } + boss_gorosh_the_dervishAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + uint32 WhirlWind_Timer; + uint32 MortalStrike_Timer; - //WhirlWind_Timer - if (WhirlWind_Timer <= diff) + void Reset() { - DoCast(me, SPELL_WHIRLWIND); - WhirlWind_Timer = 15000; - } else WhirlWind_Timer -= diff; + WhirlWind_Timer = 12000; + MortalStrike_Timer = 22000; + } - //MortalStrike_Timer - if (MortalStrike_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - DoCast(me->getVictim(), SPELL_MORTALSTRIKE); - MortalStrike_Timer = 15000; - } else MortalStrike_Timer -= diff; + } + + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + //WhirlWind_Timer + if (WhirlWind_Timer <= diff) + { + DoCast(me, SPELL_WHIRLWIND); + WhirlWind_Timer = 15000; + } else WhirlWind_Timer -= diff; + + //MortalStrike_Timer + if (MortalStrike_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_MORTALSTRIKE); + MortalStrike_Timer = 15000; + } else MortalStrike_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_gorosh_the_dervish(Creature* pCreature) -{ - return new boss_gorosh_the_dervishAI (pCreature); -} void AddSC_boss_gorosh_the_dervish() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_gorosh_the_dervish"; - newscript->GetAI = &GetAI_boss_gorosh_the_dervish; - newscript->RegisterSelf(); + new boss_gorosh_the_dervish(); } diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_grizzle.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_grizzle.cpp index f369e4d645a..bd06e6a2eb1 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_grizzle.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_grizzle.cpp @@ -35,62 +35,65 @@ enum Spells SPELL_GROUNDTREMOR = 6524, SPELL_FRENZY = 28371 }; - -struct boss_grizzleAI : public ScriptedAI +
class boss_grizzle : public CreatureScript { - boss_grizzleAI(Creature *c) : ScriptedAI(c) {} - - uint32 GroundTremor_Timer; - uint32 Frenzy_Timer; +public: + boss_grizzle() : CreatureScript("boss_grizzle") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - GroundTremor_Timer = 12000; - Frenzy_Timer =0; + return new boss_grizzleAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_grizzleAI : public ScriptedAI { - } + boss_grizzleAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + uint32 GroundTremor_Timer; + uint32 Frenzy_Timer; - //GroundTremor_Timer - if (GroundTremor_Timer <= diff) + void Reset() { - DoCast(me->getVictim(), SPELL_GROUNDTREMOR); - GroundTremor_Timer = 8000; - } else GroundTremor_Timer -= diff; + GroundTremor_Timer = 12000; + Frenzy_Timer =0; + } + + void EnterCombat(Unit * /*who*/) + { + } - //Frenzy_Timer - if (me->GetHealth()*100 / me->GetMaxHealth() < 51) + void UpdateAI(const uint32 diff) { - if (Frenzy_Timer <= diff) + //Return since we have no target + if (!UpdateVictim()) + return; + + //GroundTremor_Timer + if (GroundTremor_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_GROUNDTREMOR); + GroundTremor_Timer = 8000; + } else GroundTremor_Timer -= diff; + + //Frenzy_Timer + if (me->GetHealth()*100 / me->GetMaxHealth() < 51) { - DoCast(me, SPELL_FRENZY); - DoScriptText(EMOTE_GENERIC_FRENZY_KILL, me); + if (Frenzy_Timer <= diff) + { + DoCast(me, SPELL_FRENZY); + DoScriptText(EMOTE_GENERIC_FRENZY_KILL, me); + + Frenzy_Timer = 15000; + } else Frenzy_Timer -= diff; + } - Frenzy_Timer = 15000; - } else Frenzy_Timer -= diff; + DoMeleeAttackIfReady(); } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_grizzle(Creature* pCreature) -{ - return new boss_grizzleAI (pCreature); -} void AddSC_boss_grizzle() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_grizzle"; - newscript->GetAI = &GetAI_boss_grizzle; - newscript->RegisterSelf(); + new boss_grizzle(); } diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_high_interrogator_gerstahn.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_high_interrogator_gerstahn.cpp index 53df13eee1f..4b8ba9e6825 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_high_interrogator_gerstahn.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_high_interrogator_gerstahn.cpp @@ -32,77 +32,80 @@ enum Spells SPELL_PSYCHICSCREAM = 8122, SPELL_SHADOWSHIELD = 22417 }; - -struct boss_high_interrogator_gerstahnAI : public ScriptedAI +
class boss_high_interrogator_gerstahn : public CreatureScript { - boss_high_interrogator_gerstahnAI(Creature *c) : ScriptedAI(c) {} - - uint32 ShadowWordPain_Timer; - uint32 ManaBurn_Timer; - uint32 PsychicScream_Timer; - uint32 ShadowShield_Timer; +public: + boss_high_interrogator_gerstahn() : CreatureScript("boss_high_interrogator_gerstahn") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - ShadowWordPain_Timer = 4000; - ManaBurn_Timer = 14000; - PsychicScream_Timer = 32000; - ShadowShield_Timer = 8000; + return new boss_high_interrogator_gerstahnAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_high_interrogator_gerstahnAI : public ScriptedAI { - } + boss_high_interrogator_gerstahnAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + uint32 ShadowWordPain_Timer; + uint32 ManaBurn_Timer; + uint32 PsychicScream_Timer; + uint32 ShadowShield_Timer; - //ShadowWordPain_Timer - if (ShadowWordPain_Timer <= diff) + void Reset() { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(pTarget, SPELL_SHADOWWORDPAIN); - ShadowWordPain_Timer = 7000; - } else ShadowWordPain_Timer -= diff; + ShadowWordPain_Timer = 4000; + ManaBurn_Timer = 14000; + PsychicScream_Timer = 32000; + ShadowShield_Timer = 8000; + } - //ManaBurn_Timer - if (ManaBurn_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(pTarget, SPELL_MANABURN); - ManaBurn_Timer = 10000; - } else ManaBurn_Timer -= diff; + } - //PsychicScream_Timer - if (PsychicScream_Timer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_PSYCHICSCREAM); - PsychicScream_Timer = 30000; - } else PsychicScream_Timer -= diff; + //Return since we have no target + if (!UpdateVictim()) + return; - //ShadowShield_Timer - if (ShadowShield_Timer <= diff) - { - DoCast(me, SPELL_SHADOWSHIELD); - ShadowShield_Timer = 25000; - } else ShadowShield_Timer -= diff; + //ShadowWordPain_Timer + if (ShadowWordPain_Timer <= diff) + { + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + DoCast(pTarget, SPELL_SHADOWWORDPAIN); + ShadowWordPain_Timer = 7000; + } else ShadowWordPain_Timer -= diff; + + //ManaBurn_Timer + if (ManaBurn_Timer <= diff) + { + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + DoCast(pTarget, SPELL_MANABURN); + ManaBurn_Timer = 10000; + } else ManaBurn_Timer -= diff; + + //PsychicScream_Timer + if (PsychicScream_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_PSYCHICSCREAM); + PsychicScream_Timer = 30000; + } else PsychicScream_Timer -= diff; + + //ShadowShield_Timer + if (ShadowShield_Timer <= diff) + { + DoCast(me, SPELL_SHADOWSHIELD); + ShadowShield_Timer = 25000; + } else ShadowShield_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_high_interrogator_gerstahn(Creature* pCreature) -{ - return new boss_high_interrogator_gerstahnAI (pCreature); -} void AddSC_boss_high_interrogator_gerstahn() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_high_interrogator_gerstahn"; - newscript->GetAI = &GetAI_boss_high_interrogator_gerstahn; - newscript->RegisterSelf(); + new boss_high_interrogator_gerstahn(); } diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_magmus.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_magmus.cpp index bc0181bbb9a..cba80b82515 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_magmus.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_magmus.cpp @@ -35,66 +35,69 @@ enum eEnums { DATA_THRONE_DOOR = 24 // not id or guid of doors but number of enum in blackrock_depths.h }; - -struct boss_magmusAI : public ScriptedAI +
class boss_magmus : public CreatureScript { - boss_magmusAI(Creature *c) : ScriptedAI(c) {} - - uint32 FieryBurst_Timer; - uint32 WarStomp_Timer; +public: + boss_magmus() : CreatureScript("boss_magmus") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - FieryBurst_Timer = 5000; - WarStomp_Timer =0; + return new boss_magmusAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_magmusAI : public ScriptedAI { - } + boss_magmusAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + uint32 FieryBurst_Timer; + uint32 WarStomp_Timer; + + void Reset() + { + FieryBurst_Timer = 5000; + WarStomp_Timer =0; + } - //FieryBurst_Timer - if (FieryBurst_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - DoCast(me->getVictim(), SPELL_FIERYBURST); - FieryBurst_Timer = 6000; - } else FieryBurst_Timer -= diff; + } - //WarStomp_Timer - if (me->GetHealth()*100 / me->GetMaxHealth() < 51) + void UpdateAI(const uint32 diff) { - if (WarStomp_Timer <= diff) + //Return since we have no target + if (!UpdateVictim()) + return; + + //FieryBurst_Timer + if (FieryBurst_Timer <= diff) { - DoCast(me->getVictim(), SPELL_WARSTOMP); - WarStomp_Timer = 8000; - } else WarStomp_Timer -= diff; + DoCast(me->getVictim(), SPELL_FIERYBURST); + FieryBurst_Timer = 6000; + } else FieryBurst_Timer -= diff; + + //WarStomp_Timer + if (me->GetHealth()*100 / me->GetMaxHealth() < 51) + { + if (WarStomp_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_WARSTOMP); + WarStomp_Timer = 8000; + } else WarStomp_Timer -= diff; + } + + DoMeleeAttackIfReady(); } + // When he die open door to last chamber + void JustDied(Unit *who) + { + if (InstanceScript* pInstance = who->GetInstanceScript()) + pInstance->HandleGameObject(pInstance->GetData64(DATA_THRONE_DOOR), true); + } + }; - DoMeleeAttackIfReady(); - } - // When he die open door to last chamber - void JustDied(Unit *who) - { - if (ScriptedInstance* pInstance = who->GetInstanceData()) - pInstance->HandleGameObject(pInstance->GetData64(DATA_THRONE_DOOR), true); - } }; -CreatureAI* GetAI_boss_magmus(Creature* pCreature) -{ - return new boss_magmusAI (pCreature); -} void AddSC_boss_magmus() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_magmus"; - newscript->GetAI = &GetAI_boss_magmus; - newscript->RegisterSelf(); + new boss_magmus(); } diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_moira_bronzebeard.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_moira_bronzebeard.cpp index fe81ad5eeac..fd45bfddf9d 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_moira_bronzebeard.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_moira_bronzebeard.cpp @@ -34,67 +34,70 @@ enum Spells SPELL_SHADOWWORDPAIN = 10894, SPELL_SMITE = 10934 }; - -struct boss_moira_bronzebeardAI : public ScriptedAI +
class boss_moira_bronzebeard : public CreatureScript { - boss_moira_bronzebeardAI(Creature *c) : ScriptedAI(c) {} - - uint32 Heal_Timer; - uint32 MindBlast_Timer; - uint32 ShadowWordPain_Timer; - uint32 Smite_Timer; +public: + boss_moira_bronzebeard() : CreatureScript("boss_moira_bronzebeard") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - Heal_Timer = 12000; //These times are probably wrong - MindBlast_Timer = 16000; - ShadowWordPain_Timer = 2000; - Smite_Timer = 8000; + return new boss_moira_bronzebeardAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_moira_bronzebeardAI : public ScriptedAI { - } + boss_moira_bronzebeardAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + uint32 Heal_Timer; + uint32 MindBlast_Timer; + uint32 ShadowWordPain_Timer; + uint32 Smite_Timer; - //MindBlast_Timer - if (MindBlast_Timer <= diff) + void Reset() { - DoCast(me->getVictim(), SPELL_MINDBLAST); - MindBlast_Timer = 14000; - } else MindBlast_Timer -= diff; + Heal_Timer = 12000; //These times are probably wrong + MindBlast_Timer = 16000; + ShadowWordPain_Timer = 2000; + Smite_Timer = 8000; + } - //ShadowWordPain_Timer - if (ShadowWordPain_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - DoCast(me->getVictim(), SPELL_SHADOWWORDPAIN); - ShadowWordPain_Timer = 18000; - } else ShadowWordPain_Timer -= diff; + } - //Smite_Timer - if (Smite_Timer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_SMITE); - Smite_Timer = 10000; - } else Smite_Timer -= diff; + //Return since we have no target + if (!UpdateVictim()) + return; + + //MindBlast_Timer + if (MindBlast_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_MINDBLAST); + MindBlast_Timer = 14000; + } else MindBlast_Timer -= diff; + + //ShadowWordPain_Timer + if (ShadowWordPain_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_SHADOWWORDPAIN); + ShadowWordPain_Timer = 18000; + } else ShadowWordPain_Timer -= diff; + + //Smite_Timer + if (Smite_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_SMITE); + Smite_Timer = 10000; + } else Smite_Timer -= diff; + + } + }; - } }; -CreatureAI* GetAI_boss_moira_bronzebeard(Creature* pCreature) -{ - return new boss_moira_bronzebeardAI (pCreature); -} void AddSC_boss_moira_bronzebeard() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_moira_bronzebeard"; - newscript->GetAI = &GetAI_boss_moira_bronzebeard; - newscript->RegisterSelf(); + new boss_moira_bronzebeard(); } diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_tomb_of_seven.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_tomb_of_seven.cpp index ac1795d5e43..9b1183b9d6f 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_tomb_of_seven.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_tomb_of_seven.cpp @@ -46,46 +46,53 @@ enum Misc #define GOSSIP_ITEM_TEACH_2 "Continue..." #define GOSSIP_ITEM_TEACH_3 "[PH] Continue..." #define GOSSIP_ITEM_TRIBUTE "I want to pay tribute" - -bool GossipHello_boss_gloomrel(Player* pPlayer, Creature* pCreature) +
class boss_gloomrel : public CreatureScript { - if (pPlayer->GetQuestRewardStatus(QUEST_SPECTRAL_CHALICE) == 1 && pPlayer->GetSkillValue(SKILL_MINING) >= DATA_SKILLPOINT_MIN && !pPlayer->HasSpell(SPELL_SMELT_DARK_IRON)) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_TEACH_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - - if (pPlayer->GetQuestRewardStatus(QUEST_SPECTRAL_CHALICE) == 0 && pPlayer->GetSkillValue(SKILL_MINING) >= DATA_SKILLPOINT_MIN) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_TRIBUTE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); +public: + boss_gloomrel() : CreatureScript("boss_gloomrel") { } - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), 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_ITEM_TEACH_2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 11); + pPlayer->SEND_GOSSIP_MENU(2606, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+11: + pPlayer->CLOSE_GOSSIP_MENU(); + pCreature->CastSpell(pPlayer, SPELL_LEARN_SMELT, false); + break; + case GOSSIP_ACTION_INFO_DEF+2: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_TEACH_3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 22); + pPlayer->SEND_GOSSIP_MENU(2604, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+22: + pPlayer->CLOSE_GOSSIP_MENU(); + if (InstanceScript* pInstance = pCreature->GetInstanceScript()) + { + //are 5 minutes expected? go template may have data to despawn when used at quest + pInstance->DoRespawnGameObject(pInstance->GetData64(DATA_GO_CHALICE),MINUTE*5); + } + break; + } + return true; + } -bool GossipSelect_boss_gloomrel(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_ITEM_TEACH_2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 11); - pPlayer->SEND_GOSSIP_MENU(2606, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+11: - pPlayer->CLOSE_GOSSIP_MENU(); - pCreature->CastSpell(pPlayer, SPELL_LEARN_SMELT, false); - break; - case GOSSIP_ACTION_INFO_DEF+2: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_TEACH_3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 22); - pPlayer->SEND_GOSSIP_MENU(2604, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+22: - pPlayer->CLOSE_GOSSIP_MENU(); - if (ScriptedInstance* pInstance = pCreature->GetInstanceData()) - { - //are 5 minutes expected? go template may have data to despawn when used at quest - pInstance->DoRespawnGameObject(pInstance->GetData64(DATA_GO_CHALICE),MINUTE*5); - } - break; + if (pPlayer->GetQuestRewardStatus(QUEST_SPECTRAL_CHALICE) == 1 && pPlayer->GetSkillValue(SKILL_MINING) >= DATA_SKILLPOINT_MIN && !pPlayer->HasSpell(SPELL_SMELT_DARK_IRON)) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_TEACH_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + + if (pPlayer->GetQuestRewardStatus(QUEST_SPECTRAL_CHALICE) == 0 && pPlayer->GetSkillValue(SKILL_MINING) >= DATA_SKILLPOINT_MIN) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_TRIBUTE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + return true; } - return true; -} + +}; + enum DoomrelSpells { @@ -96,161 +103,155 @@ enum DoomrelSpells SPELL_SUMMON_VOIDWALKERS = 15092 }; -struct boss_doomrelAI : public ScriptedAI +#define GOSSIP_ITEM_CHALLENGE "Your bondage is at an end, Doom'rel. I challenge you!" +#define GOSSIP_SELECT_DOOMREL "[PH] Continue..." +
class boss_doomrel : public CreatureScript { - boss_doomrelAI(Creature *c) : ScriptedAI(c) - { - pInstance = c->GetInstanceData(); - } +public: + boss_doomrel() : CreatureScript("boss_doomrel") { } - ScriptedInstance* pInstance; - uint32 ShadowVolley_Timer; - uint32 Immolate_Timer; - uint32 CurseOfWeakness_Timer; - uint32 DemonArmor_Timer; - bool Voidwalkers; - - void Reset() + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - ShadowVolley_Timer = 10000; - Immolate_Timer = 18000; - CurseOfWeakness_Timer = 5000; - DemonArmor_Timer = 16000; - Voidwalkers = false; - - me->setFaction(FACTION_FRIEND); - - // was set before event start, so set again - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); - - if (pInstance) - if (pInstance->GetData(DATA_GHOSTKILL) >= 7) - me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE); - else - me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + switch (uiAction) + { + case GOSSIP_ACTION_INFO_DEF+1: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT_DOOMREL, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + pPlayer->SEND_GOSSIP_MENU(2605, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+2: + pPlayer->CLOSE_GOSSIP_MENU(); + //start event here + pCreature->setFaction(FACTION_HOSTILE); + pCreature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + pCreature->AI()->AttackStart(pPlayer); + InstanceScript* pInstance = pCreature->GetInstanceScript(); + if (pInstance) + pInstance->SetData64(DATA_EVENSTARTER,pPlayer->GetGUID()); + break; + } + return true; } - void EnterCombat(Unit * /*who*/) + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - } + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_CHALLENGE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + pPlayer->SEND_GOSSIP_MENU(2601, pCreature->GetGUID()); - void EnterEvadeMode() - { - me->RemoveAllAuras(); - me->DeleteThreatList(); - me->CombatStop(true); - me->LoadCreaturesAddon(); - if (me->isAlive()) - me->GetMotionMaster()->MoveTargetedHome(); - me->SetLootRecipient(NULL); - if (pInstance) - pInstance->SetData64(DATA_EVENSTARTER, 0); + return true; } - void JustDied(Unit * /*who*/) + CreatureAI* GetAI(Creature* pCreature) const { - if (pInstance) - pInstance->SetData(DATA_GHOSTKILL, 1); + return new boss_doomrelAI (pCreature); } - void UpdateAI(const uint32 diff) + struct boss_doomrelAI : public ScriptedAI { - if (!UpdateVictim()) - return; - - //ShadowVolley_Timer - if (ShadowVolley_Timer <= diff) + boss_doomrelAI(Creature *c) : ScriptedAI(c) { - DoCast(me->getVictim(), SPELL_SHADOWBOLTVOLLEY); - ShadowVolley_Timer = 12000; - } else ShadowVolley_Timer -= diff; + pInstance = c->GetInstanceScript(); + } + + InstanceScript* pInstance; + uint32 ShadowVolley_Timer; + uint32 Immolate_Timer; + uint32 CurseOfWeakness_Timer; + uint32 DemonArmor_Timer; + bool Voidwalkers; - //Immolate_Timer - if (Immolate_Timer <= diff) + void Reset() { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(pTarget, SPELL_IMMOLATE); + ShadowVolley_Timer = 10000; + Immolate_Timer = 18000; + CurseOfWeakness_Timer = 5000; + DemonArmor_Timer = 16000; + Voidwalkers = false; - Immolate_Timer = 25000; - } else Immolate_Timer -= diff; + me->setFaction(FACTION_FRIEND); - //CurseOfWeakness_Timer - if (CurseOfWeakness_Timer <= diff) + // was set before event start, so set again + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + + if (pInstance) + if (pInstance->GetData(DATA_GHOSTKILL) >= 7) + me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE); + else + me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + } + + void EnterCombat(Unit * /*who*/) { - DoCast(me->getVictim(), SPELL_CURSEOFWEAKNESS); - CurseOfWeakness_Timer = 45000; - } else CurseOfWeakness_Timer -= diff; + } - //DemonArmor_Timer - if (DemonArmor_Timer <= diff) + void EnterEvadeMode() { - DoCast(me, SPELL_DEMONARMOR); - DemonArmor_Timer = 300000; - } else DemonArmor_Timer -= diff; + me->RemoveAllAuras(); + me->DeleteThreatList(); + me->CombatStop(true); + me->LoadCreaturesAddon(); + if (me->isAlive()) + me->GetMotionMaster()->MoveTargetedHome(); + me->SetLootRecipient(NULL); + if (pInstance) + pInstance->SetData64(DATA_EVENSTARTER, 0); + } - //Summon Voidwalkers - if (!Voidwalkers && me->GetHealth()*100 / me->GetMaxHealth() < 51) + void JustDied(Unit * /*who*/) { - DoCast(me->getVictim(), SPELL_SUMMON_VOIDWALKERS, true); - Voidwalkers = true; + if (pInstance) + pInstance->SetData(DATA_GHOSTKILL, 1); } - DoMeleeAttackIfReady(); - } -}; + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; -CreatureAI* GetAI_boss_doomrel(Creature* pCreature) -{ - return new boss_doomrelAI (pCreature); -} + //ShadowVolley_Timer + if (ShadowVolley_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_SHADOWBOLTVOLLEY); + ShadowVolley_Timer = 12000; + } else ShadowVolley_Timer -= diff; -#define GOSSIP_ITEM_CHALLENGE "Your bondage is at an end, Doom'rel. I challenge you!" -#define GOSSIP_SELECT_DOOMREL "[PH] Continue..." + //Immolate_Timer + if (Immolate_Timer <= diff) + { + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + DoCast(pTarget, SPELL_IMMOLATE); -bool GossipHello_boss_doomrel(Player* pPlayer, Creature* pCreature) -{ - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_CHALLENGE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - pPlayer->SEND_GOSSIP_MENU(2601, pCreature->GetGUID()); + Immolate_Timer = 25000; + } else Immolate_Timer -= diff; - return true; -} + //CurseOfWeakness_Timer + if (CurseOfWeakness_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_CURSEOFWEAKNESS); + CurseOfWeakness_Timer = 45000; + } else CurseOfWeakness_Timer -= diff; -bool GossipSelect_boss_doomrel(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - switch (uiAction) - { - case GOSSIP_ACTION_INFO_DEF+1: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT_DOOMREL, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - pPlayer->SEND_GOSSIP_MENU(2605, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+2: - pPlayer->CLOSE_GOSSIP_MENU(); - //start event here - pCreature->setFaction(FACTION_HOSTILE); - pCreature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); - pCreature->AI()->AttackStart(pPlayer); - ScriptedInstance* pInstance = pCreature->GetInstanceData(); - if (pInstance) - pInstance->SetData64(DATA_EVENSTARTER,pPlayer->GetGUID()); - break; - } - return true; -} + //DemonArmor_Timer + if (DemonArmor_Timer <= diff) + { + DoCast(me, SPELL_DEMONARMOR); + DemonArmor_Timer = 300000; + } else DemonArmor_Timer -= diff; + + //Summon Voidwalkers + if (!Voidwalkers && me->GetHealth()*100 / me->GetMaxHealth() < 51) + { + DoCast(me->getVictim(), SPELL_SUMMON_VOIDWALKERS, true); + Voidwalkers = true; + } + + DoMeleeAttackIfReady(); + } + }; + +}; void AddSC_boss_tomb_of_seven() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_gloomrel"; - newscript->pGossipHello = &GossipHello_boss_gloomrel; - newscript->pGossipSelect = &GossipSelect_boss_gloomrel; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_doomrel"; - newscript->GetAI = &GetAI_boss_doomrel; - newscript->pGossipHello = &GossipHello_boss_doomrel; - newscript->pGossipSelect = &GossipSelect_boss_doomrel; - newscript->RegisterSelf(); + new boss_gloomrel(); + new boss_doomrel(); } diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/instance_blackrock_depths.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/instance_blackrock_depths.cpp index 9be222e8bb2..ab238d8ebef 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockDepths/instance_blackrock_depths.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/instance_blackrock_depths.cpp @@ -74,389 +74,392 @@ enum eEnums GO_SPECTRAL_CHALICE = 164869, GO_CHEST_SEVEN = 169243 }; - -struct instance_blackrock_depths : public ScriptedInstance +
class instance_blackrock_depths : public InstanceMapScript { - instance_blackrock_depths(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; - - uint32 m_auiEncounter[MAX_ENCOUNTER]; - std::string str_data; - - uint64 EmperorGUID; - uint64 PhalanxGUID; - uint64 MagmusGUID; - - uint64 GoArena1GUID; - uint64 GoArena2GUID; - uint64 GoArena3GUID; - uint64 GoArena4GUID; - uint64 GoShadowLockGUID; - uint64 GoShadowMechGUID; - uint64 GoShadowGiantGUID; - uint64 GoShadowDummyGUID; - uint64 GoBarKegGUID; - uint64 GoBarKegTrapGUID; - uint64 GoBarDoorGUID; - uint64 GoTombEnterGUID; - uint64 GoTombExitGUID; - uint64 GoLyceumGUID; - uint64 GoSFSGUID; - uint64 GoSFNGUID; - uint64 GoGolemNGUID; - uint64 GoGolemSGUID; - uint64 GoThroneGUID; - uint64 GoChestGUID; - - uint32 BarAleCount; - uint32 GhostKillCount; - uint64 TombBossGUIDs[7]; - uint64 TombEventStarterGUID; - uint32 TombTimer; - uint32 TombEventCounter; - - void Initialize() +public: + instance_blackrock_depths() : InstanceMapScript("instance_blackrock_depths") { } + + InstanceScript* GetInstanceData_InstanceMapScript(Map* pMap) { - memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - - EmperorGUID = 0; - PhalanxGUID = 0; - MagmusGUID = 0; - - GoArena1GUID = 0; - GoArena2GUID = 0; - GoArena3GUID = 0; - GoArena4GUID = 0; - GoShadowLockGUID = 0; - GoShadowMechGUID = 0; - GoShadowGiantGUID = 0; - GoShadowDummyGUID = 0; - GoBarKegGUID = 0; - GoBarKegTrapGUID = 0; - GoBarDoorGUID = 0; - GoTombEnterGUID = 0; - GoTombExitGUID = 0; - GoLyceumGUID = 0; - GoSFSGUID = 0; - GoSFNGUID = 0; - GoGolemNGUID = 0; - GoGolemSGUID = 0; - GoThroneGUID = 0; - GoChestGUID = 0; - - BarAleCount = 0; - GhostKillCount = 0; - TombEventStarterGUID = 0; - TombTimer = TIMER_TOMBOFTHESEVEN; - TombEventCounter = 0; - - for (uint8 i = 0; i < 7; ++i) - TombBossGUIDs[i] = 0; + return new instance_blackrock_depths_InstanceMapScript(pMap); } - void OnCreatureCreate(Creature* pCreature, bool /*add*/) + struct instance_blackrock_depths_InstanceMapScript : public InstanceScript { - switch(pCreature->GetEntry()) + instance_blackrock_depths_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {Initialize();}; + + uint32 m_auiEncounter[MAX_ENCOUNTER]; + std::string str_data; + + uint64 EmperorGUID; + uint64 PhalanxGUID; + uint64 MagmusGUID; + + uint64 GoArena1GUID; + uint64 GoArena2GUID; + uint64 GoArena3GUID; + uint64 GoArena4GUID; + uint64 GoShadowLockGUID; + uint64 GoShadowMechGUID; + uint64 GoShadowGiantGUID; + uint64 GoShadowDummyGUID; + uint64 GoBarKegGUID; + uint64 GoBarKegTrapGUID; + uint64 GoBarDoorGUID; + uint64 GoTombEnterGUID; + uint64 GoTombExitGUID; + uint64 GoLyceumGUID; + uint64 GoSFSGUID; + uint64 GoSFNGUID; + uint64 GoGolemNGUID; + uint64 GoGolemSGUID; + uint64 GoThroneGUID; + uint64 GoChestGUID; + + uint32 BarAleCount; + uint32 GhostKillCount; + uint64 TombBossGUIDs[7]; + uint64 TombEventStarterGUID; + uint32 TombTimer; + uint32 TombEventCounter; + + void Initialize() { - case NPC_EMPEROR: EmperorGUID = pCreature->GetGUID(); break; - case NPC_PHALANX: PhalanxGUID = pCreature->GetGUID(); break; - case NPC_DOOMREL: TombBossGUIDs[0] = pCreature->GetGUID(); break; - case NPC_DOPEREL: TombBossGUIDs[1] = pCreature->GetGUID(); break; - case NPC_HATEREL: TombBossGUIDs[2] = pCreature->GetGUID(); break; - case NPC_VILEREL: TombBossGUIDs[3] = pCreature->GetGUID(); break; - case NPC_SEETHREL: TombBossGUIDs[4] = pCreature->GetGUID(); break; - case NPC_GLOOMREL: TombBossGUIDs[5] = pCreature->GetGUID(); break; - case NPC_ANGERREL: TombBossGUIDs[6] = pCreature->GetGUID(); break; - case NPC_MAGMUS: - MagmusGUID = pCreature->GetGUID(); - if (!pCreature->isAlive()) - HandleGameObject(GetData64(DATA_THRONE_DOOR), true); // if Magmus is dead open door to last boss - break; + memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); + + EmperorGUID = 0; + PhalanxGUID = 0; + MagmusGUID = 0; + + GoArena1GUID = 0; + GoArena2GUID = 0; + GoArena3GUID = 0; + GoArena4GUID = 0; + GoShadowLockGUID = 0; + GoShadowMechGUID = 0; + GoShadowGiantGUID = 0; + GoShadowDummyGUID = 0; + GoBarKegGUID = 0; + GoBarKegTrapGUID = 0; + GoBarDoorGUID = 0; + GoTombEnterGUID = 0; + GoTombExitGUID = 0; + GoLyceumGUID = 0; + GoSFSGUID = 0; + GoSFNGUID = 0; + GoGolemNGUID = 0; + GoGolemSGUID = 0; + GoThroneGUID = 0; + GoChestGUID = 0; + + BarAleCount = 0; + GhostKillCount = 0; + TombEventStarterGUID = 0; + TombTimer = TIMER_TOMBOFTHESEVEN; + TombEventCounter = 0; + + for (uint8 i = 0; i < 7; ++i) + TombBossGUIDs[i] = 0; } - } - void OnGameObjectCreate(GameObject* pGo, bool /*add*/) - { - switch(pGo->GetEntry()) + void OnCreatureCreate(Creature* pCreature, bool /*add*/) { - case GO_ARENA1: GoArena1GUID = pGo->GetGUID(); break; - case GO_ARENA2: GoArena2GUID = pGo->GetGUID(); break; - case GO_ARENA3: GoArena3GUID = pGo->GetGUID(); break; - case GO_ARENA4: GoArena4GUID = pGo->GetGUID(); break; - case GO_SHADOW_LOCK: GoShadowLockGUID = pGo->GetGUID(); break; - case GO_SHADOW_MECHANISM: GoShadowMechGUID = pGo->GetGUID(); break; - case GO_SHADOW_GIANT_DOOR: GoShadowGiantGUID = pGo->GetGUID(); break; - case GO_SHADOW_DUMMY: GoShadowDummyGUID = pGo->GetGUID(); break; - case GO_BAR_KEG_SHOT: GoBarKegGUID = pGo->GetGUID(); break; - case GO_BAR_KEG_TRAP: GoBarKegTrapGUID = pGo->GetGUID(); break; - case GO_BAR_DOOR: GoBarDoorGUID = pGo->GetGUID(); break; - case GO_TOMB_ENTER: GoTombEnterGUID = pGo->GetGUID(); break; - case GO_TOMB_EXIT: - GoTombExitGUID = pGo->GetGUID(); - if (GhostKillCount >= 7) - HandleGameObject(0, true, pGo); - else - HandleGameObject(0, false, pGo); - break; - case GO_LYCEUM: GoLyceumGUID = pGo->GetGUID(); break; - case GO_SF_S: GoSFSGUID = pGo->GetGUID(); break; - case GO_SF_N: GoSFNGUID = pGo->GetGUID(); break; - case GO_GOLEM_ROOM_N: GoGolemNGUID = pGo->GetGUID(); break; - case GO_GOLEM_ROOM_S: GoGolemSGUID = pGo->GetGUID(); break; - case GO_THRONE_ROOM: GoThroneGUID = pGo->GetGUID(); break; - case GO_CHEST_SEVEN: GoChestGUID = pGo->GetGUID(); break; + switch(pCreature->GetEntry()) + { + case NPC_EMPEROR: EmperorGUID = pCreature->GetGUID(); break; + case NPC_PHALANX: PhalanxGUID = pCreature->GetGUID(); break; + case NPC_DOOMREL: TombBossGUIDs[0] = pCreature->GetGUID(); break; + case NPC_DOPEREL: TombBossGUIDs[1] = pCreature->GetGUID(); break; + case NPC_HATEREL: TombBossGUIDs[2] = pCreature->GetGUID(); break; + case NPC_VILEREL: TombBossGUIDs[3] = pCreature->GetGUID(); break; + case NPC_SEETHREL: TombBossGUIDs[4] = pCreature->GetGUID(); break; + case NPC_GLOOMREL: TombBossGUIDs[5] = pCreature->GetGUID(); break; + case NPC_ANGERREL: TombBossGUIDs[6] = pCreature->GetGUID(); break; + case NPC_MAGMUS: + MagmusGUID = pCreature->GetGUID(); + if (!pCreature->isAlive()) + HandleGameObject(GetData64(DATA_THRONE_DOOR), true); // if Magmus is dead open door to last boss + break; + } } - } - - void SetData64(uint32 type, uint64 data) - { - sLog.outDebug("TSCR: Instance Blackrock Depths: SetData64 update (Type: %u Data %u)", type, data); - switch(type) + void OnGameObjectCreate(GameObject* pGo, bool /*add*/) { - case DATA_EVENSTARTER: - TombEventStarterGUID = data; - if (!TombEventStarterGUID) - TombOfSevenReset();//reset - else - TombOfSevenStart();//start - break; + switch(pGo->GetEntry()) + { + case GO_ARENA1: GoArena1GUID = pGo->GetGUID(); break; + case GO_ARENA2: GoArena2GUID = pGo->GetGUID(); break; + case GO_ARENA3: GoArena3GUID = pGo->GetGUID(); break; + case GO_ARENA4: GoArena4GUID = pGo->GetGUID(); break; + case GO_SHADOW_LOCK: GoShadowLockGUID = pGo->GetGUID(); break; + case GO_SHADOW_MECHANISM: GoShadowMechGUID = pGo->GetGUID(); break; + case GO_SHADOW_GIANT_DOOR: GoShadowGiantGUID = pGo->GetGUID(); break; + case GO_SHADOW_DUMMY: GoShadowDummyGUID = pGo->GetGUID(); break; + case GO_BAR_KEG_SHOT: GoBarKegGUID = pGo->GetGUID(); break; + case GO_BAR_KEG_TRAP: GoBarKegTrapGUID = pGo->GetGUID(); break; + case GO_BAR_DOOR: GoBarDoorGUID = pGo->GetGUID(); break; + case GO_TOMB_ENTER: GoTombEnterGUID = pGo->GetGUID(); break; + case GO_TOMB_EXIT: + GoTombExitGUID = pGo->GetGUID(); + if (GhostKillCount >= 7) + HandleGameObject(0, true, pGo); + else + HandleGameObject(0, false, pGo); + break; + case GO_LYCEUM: GoLyceumGUID = pGo->GetGUID(); break; + case GO_SF_S: GoSFSGUID = pGo->GetGUID(); break; + case GO_SF_N: GoSFNGUID = pGo->GetGUID(); break; + case GO_GOLEM_ROOM_N: GoGolemNGUID = pGo->GetGUID(); break; + case GO_GOLEM_ROOM_S: GoGolemSGUID = pGo->GetGUID(); break; + case GO_THRONE_ROOM: GoThroneGUID = pGo->GetGUID(); break; + case GO_CHEST_SEVEN: GoChestGUID = pGo->GetGUID(); break; + } } - } - void SetData(uint32 type, uint32 data) - { - sLog.outDebug("TSCR: Instance Blackrock Depths: SetData update (Type: %u Data %u)", type, data); - - switch(type) + void SetData64(uint32 type, uint64 data) { - case TYPE_RING_OF_LAW: - m_auiEncounter[0] = data; - break; - case TYPE_VAULT: - m_auiEncounter[1] = data; - break; - case TYPE_BAR: - if (data == SPECIAL) - ++BarAleCount; - else - m_auiEncounter[2] = data; - break; - case TYPE_TOMB_OF_SEVEN: - m_auiEncounter[3] = data; - break; - case TYPE_LYCEUM: - m_auiEncounter[4] = data; - break; - case TYPE_IRON_HALL: - m_auiEncounter[5] = data; - break; - case DATA_GHOSTKILL: - GhostKillCount += data; - break; + sLog.outDebug("TSCR: Instance Blackrock Depths: SetData64 update (Type: %u Data %u)", type, data); + + switch(type) + { + case DATA_EVENSTARTER: + TombEventStarterGUID = data; + if (!TombEventStarterGUID) + TombOfSevenReset();//reset + else + TombOfSevenStart();//start + break; + } } - if (data == DONE || GhostKillCount >= 7) + void SetData(uint32 type, uint32 data) { - OUT_SAVE_INST_DATA; + sLog.outDebug("TSCR: Instance Blackrock Depths: SetData update (Type: %u Data %u)", type, data); - std::ostringstream saveStream; - saveStream << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " << m_auiEncounter[2] << " " - << m_auiEncounter[3] << " " << m_auiEncounter[4] << " " << m_auiEncounter[5] << " " << GhostKillCount; + switch(type) + { + case TYPE_RING_OF_LAW: + m_auiEncounter[0] = data; + break; + case TYPE_VAULT: + m_auiEncounter[1] = data; + break; + case TYPE_BAR: + if (data == SPECIAL) + ++BarAleCount; + else + m_auiEncounter[2] = data; + break; + case TYPE_TOMB_OF_SEVEN: + m_auiEncounter[3] = data; + break; + case TYPE_LYCEUM: + m_auiEncounter[4] = data; + break; + case TYPE_IRON_HALL: + m_auiEncounter[5] = data; + break; + case DATA_GHOSTKILL: + GhostKillCount += data; + break; + } + + if (data == DONE || GhostKillCount >= 7) + { + 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] << " " << GhostKillCount; - str_data = saveStream.str(); + str_data = saveStream.str(); - SaveToDB(); - OUT_SAVE_INST_DATA_COMPLETE; + SaveToDB(); + OUT_SAVE_INST_DATA_COMPLETE; + } } - } - uint32 GetData(uint32 type) - { - switch(type) + uint32 GetData(uint32 type) { - case TYPE_RING_OF_LAW: - return m_auiEncounter[0]; - case TYPE_VAULT: - return m_auiEncounter[1]; - case TYPE_BAR: - if (m_auiEncounter[2] == IN_PROGRESS && BarAleCount == 3) - return SPECIAL; - else - return m_auiEncounter[2]; - case TYPE_TOMB_OF_SEVEN: - return m_auiEncounter[3]; - case TYPE_LYCEUM: - return m_auiEncounter[4]; - case TYPE_IRON_HALL: - return m_auiEncounter[5]; - case DATA_GHOSTKILL: - return GhostKillCount; + switch(type) + { + case TYPE_RING_OF_LAW: + return m_auiEncounter[0]; + case TYPE_VAULT: + return m_auiEncounter[1]; + case TYPE_BAR: + if (m_auiEncounter[2] == IN_PROGRESS && BarAleCount == 3) + return SPECIAL; + else + return m_auiEncounter[2]; + case TYPE_TOMB_OF_SEVEN: + return m_auiEncounter[3]; + case TYPE_LYCEUM: + return m_auiEncounter[4]; + case TYPE_IRON_HALL: + return m_auiEncounter[5]; + case DATA_GHOSTKILL: + return GhostKillCount; + } + return 0; } - return 0; - } - uint64 GetData64(uint32 data) - { - switch(data) + uint64 GetData64(uint32 data) { - case DATA_EMPEROR: - return EmperorGUID; - case DATA_PHALANX: - return PhalanxGUID; - case DATA_ARENA1: - return GoArena1GUID; - case DATA_ARENA2: - return GoArena2GUID; - case DATA_ARENA3: - return GoArena3GUID; - case DATA_ARENA4: - return GoArena4GUID; - case DATA_GO_BAR_KEG: - return GoBarKegGUID; - case DATA_GO_BAR_KEG_TRAP: - return GoBarKegTrapGUID; - case DATA_GO_BAR_DOOR: - return GoBarDoorGUID; - case DATA_EVENSTARTER: - return TombEventStarterGUID; - case DATA_SF_BRAZIER_N: - return GoSFNGUID; - case DATA_SF_BRAZIER_S: - return GoSFSGUID; - case DATA_THRONE_DOOR: - return GoThroneGUID; - case DATA_GOLEM_DOOR_N: - return GoGolemNGUID; - case DATA_GOLEM_DOOR_S: - return GoGolemSGUID; + switch(data) + { + case DATA_EMPEROR: + return EmperorGUID; + case DATA_PHALANX: + return PhalanxGUID; + case DATA_ARENA1: + return GoArena1GUID; + case DATA_ARENA2: + return GoArena2GUID; + case DATA_ARENA3: + return GoArena3GUID; + case DATA_ARENA4: + return GoArena4GUID; + case DATA_GO_BAR_KEG: + return GoBarKegGUID; + case DATA_GO_BAR_KEG_TRAP: + return GoBarKegTrapGUID; + case DATA_GO_BAR_DOOR: + return GoBarDoorGUID; + case DATA_EVENSTARTER: + return TombEventStarterGUID; + case DATA_SF_BRAZIER_N: + return GoSFNGUID; + case DATA_SF_BRAZIER_S: + return GoSFSGUID; + case DATA_THRONE_DOOR: + return GoThroneGUID; + case DATA_GOLEM_DOOR_N: + return GoGolemNGUID; + case DATA_GOLEM_DOOR_S: + return GoGolemSGUID; + } + return 0; } - return 0; - } - std::string GetSaveData() - { - return str_data; - } - - void Load(const char* in) - { - if (!in) + std::string GetSaveData() { - OUT_LOAD_INST_DATA_FAIL; - return; + return str_data; } - OUT_LOAD_INST_DATA(in); + void Load(const char* in) + { + if (!in) + { + OUT_LOAD_INST_DATA_FAIL; + return; + } - std::istringstream loadStream(in); - loadStream >> m_auiEncounter[0] >> m_auiEncounter[1] >> m_auiEncounter[2] >> m_auiEncounter[3] - >> m_auiEncounter[4] >> m_auiEncounter[5] >> GhostKillCount; + OUT_LOAD_INST_DATA(in); - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) - m_auiEncounter[i] = NOT_STARTED; - if (GhostKillCount > 0 && GhostKillCount < 7) - GhostKillCount = 0;//reset tomb of seven event - if (GhostKillCount >= 7) - GhostKillCount = 7; + std::istringstream loadStream(in); + loadStream >> m_auiEncounter[0] >> m_auiEncounter[1] >> m_auiEncounter[2] >> m_auiEncounter[3] + >> m_auiEncounter[4] >> m_auiEncounter[5] >> GhostKillCount; - OUT_LOAD_INST_DATA_COMPLETE; - } + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + if (m_auiEncounter[i] == IN_PROGRESS) + m_auiEncounter[i] = NOT_STARTED; + if (GhostKillCount > 0 && GhostKillCount < 7) + GhostKillCount = 0;//reset tomb of seven event + if (GhostKillCount >= 7) + GhostKillCount = 7; - void TombOfSevenEvent() - { - if (GhostKillCount < 7 && TombBossGUIDs[TombEventCounter]) + OUT_LOAD_INST_DATA_COMPLETE; + } + + void TombOfSevenEvent() { - if (Creature* boss = instance->GetCreature(TombBossGUIDs[TombEventCounter])) + if (GhostKillCount < 7 && TombBossGUIDs[TombEventCounter]) { - boss->setFaction(FACTION_HOSTILE); - boss->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); - if (Unit *pTarget = boss->SelectNearestTarget(500)) - boss->AI()->AttackStart(pTarget); + if (Creature* boss = instance->GetCreature(TombBossGUIDs[TombEventCounter])) + { + boss->setFaction(FACTION_HOSTILE); + boss->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + if (Unit *pTarget = boss->SelectNearestTarget(500)) + boss->AI()->AttackStart(pTarget); + } } } - } - void TombOfSevenReset() - { - HandleGameObject(GoTombExitGUID,false);//event reseted, close exit door - HandleGameObject(GoTombEnterGUID,true);//event reseted, open entrance door - for (uint8 i = 0; i < 7; ++i) + void TombOfSevenReset() { - if (Creature* boss = instance->GetCreature(TombBossGUIDs[i])) + HandleGameObject(GoTombExitGUID,false);//event reseted, close exit door + HandleGameObject(GoTombEnterGUID,true);//event reseted, open entrance door + for (uint8 i = 0; i < 7; ++i) { - if (!boss->isAlive()) - {//do not call EnterEvadeMode(), it will create infinit loops - boss->Respawn(); - boss->RemoveAllAuras(); - boss->DeleteThreatList(); - boss->CombatStop(true); - boss->LoadCreaturesAddon(); - boss->GetMotionMaster()->MoveTargetedHome(); - boss->SetLootRecipient(NULL); + if (Creature* boss = instance->GetCreature(TombBossGUIDs[i])) + { + if (!boss->isAlive()) + {//do not call EnterEvadeMode(), it will create infinit loops + boss->Respawn(); + boss->RemoveAllAuras(); + boss->DeleteThreatList(); + boss->CombatStop(true); + boss->LoadCreaturesAddon(); + boss->GetMotionMaster()->MoveTargetedHome(); + boss->SetLootRecipient(NULL); + } + boss->setFaction(FACTION_FRIEND); } - boss->setFaction(FACTION_FRIEND); } + GhostKillCount = 0; + TombEventStarterGUID = 0; + TombEventCounter = 0; + TombTimer = TIMER_TOMBOFTHESEVEN; + SetData(TYPE_TOMB_OF_SEVEN, NOT_STARTED); } - GhostKillCount = 0; - TombEventStarterGUID = 0; - TombEventCounter = 0; - TombTimer = TIMER_TOMBOFTHESEVEN; - SetData(TYPE_TOMB_OF_SEVEN, NOT_STARTED); - } - void TombOfSevenStart() - { - HandleGameObject(GoTombExitGUID,false);//event started, close exit door - HandleGameObject(GoTombEnterGUID,false);//event started, close entrance door - SetData(TYPE_TOMB_OF_SEVEN, IN_PROGRESS); - } + void TombOfSevenStart() + { + HandleGameObject(GoTombExitGUID,false);//event started, close exit door + HandleGameObject(GoTombEnterGUID,false);//event started, close entrance door + SetData(TYPE_TOMB_OF_SEVEN, IN_PROGRESS); + } - void TombOfSevenEnd() - { - DoRespawnGameObject(GoChestGUID,DAY); - HandleGameObject(GoTombExitGUID,true);//event done, open exit door - HandleGameObject(GoTombEnterGUID,true);//event done, open entrance door - TombEventStarterGUID = 0; - SetData(TYPE_TOMB_OF_SEVEN, DONE); - } - void Update(uint32 diff) - { - if (TombEventStarterGUID && GhostKillCount < 7) + void TombOfSevenEnd() + { + DoRespawnGameObject(GoChestGUID,DAY); + HandleGameObject(GoTombExitGUID,true);//event done, open exit door + HandleGameObject(GoTombEnterGUID,true);//event done, open entrance door + TombEventStarterGUID = 0; + SetData(TYPE_TOMB_OF_SEVEN, DONE); + } + void Update(uint32 diff) { - if (TombTimer <= diff) + if (TombEventStarterGUID && GhostKillCount < 7) { - TombTimer = TIMER_TOMBOFTHESEVEN; - ++TombEventCounter; - TombOfSevenEvent(); - // Check Killed bosses - for (uint8 i = 0; i < 7; ++i) + if (TombTimer <= diff) { - if (Creature* boss = instance->GetCreature(TombBossGUIDs[i])) + TombTimer = TIMER_TOMBOFTHESEVEN; + ++TombEventCounter; + TombOfSevenEvent(); + // Check Killed bosses + for (uint8 i = 0; i < 7; ++i) { - if (!boss->isAlive()) + if (Creature* boss = instance->GetCreature(TombBossGUIDs[i])) { - GhostKillCount = i+1; - } + if (!boss->isAlive()) + { + GhostKillCount = i+1; + } + } } - } - } else TombTimer -= diff; + } else TombTimer -= diff; + } + if (GhostKillCount >= 7 && TombEventStarterGUID) + TombOfSevenEnd(); } - if (GhostKillCount >= 7 && TombEventStarterGUID) - TombOfSevenEnd(); - } + }; + }; -InstanceData* GetInstanceData_instance_blackrock_depths(Map* pMap) -{ - return new instance_blackrock_depths(pMap); -} void AddSC_instance_blackrock_depths() - { - Script *newscript; - newscript = new Script; - newscript->Name = "instance_blackrock_depths"; - newscript->GetInstanceData = &GetInstanceData_instance_blackrock_depths; - newscript->RegisterSelf(); - } +{ + new instance_blackrock_depths(); +} diff --git a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_drakkisath.cpp b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_drakkisath.cpp index 612201efa1c..9d8abe0da9b 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_drakkisath.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_drakkisath.cpp @@ -29,76 +29,78 @@ EndScriptData */ #define SPELL_CLEAVE 20691 #define SPELL_CONFLIGURATION 16805 #define SPELL_THUNDERCLAP 15548 //Not sure if right ID. 23931 would be a harder possibility. - -struct boss_drakkisathAI : public ScriptedAI +
class boss_drakkisath : public CreatureScript { - boss_drakkisathAI(Creature *c) : ScriptedAI(c) {} - - uint32 FireNova_Timer; - uint32 Cleave_Timer; - uint32 Confliguration_Timer; - uint32 Thunderclap_Timer; - - void Reset() - { - FireNova_Timer = 6000; - Cleave_Timer = 8000; - Confliguration_Timer = 15000; - Thunderclap_Timer = 17000; - } +public: + boss_drakkisath() : CreatureScript("boss_drakkisath") { } - void EnterCombat(Unit * /*who*/) + CreatureAI* GetAI(Creature* pCreature) const { + return new boss_drakkisathAI (pCreature); } - void UpdateAI(const uint32 diff) + struct boss_drakkisathAI : public ScriptedAI { - //Return since we have no target - if (!UpdateVictim()) - return; + boss_drakkisathAI(Creature *c) : ScriptedAI(c) {} - //FireNova_Timer - if (FireNova_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_FIRENOVA); - FireNova_Timer = 10000; - } else FireNova_Timer -= diff; + uint32 FireNova_Timer; + uint32 Cleave_Timer; + uint32 Confliguration_Timer; + uint32 Thunderclap_Timer; - //Cleave_Timer - if (Cleave_Timer <= diff) + void Reset() { - DoCast(me->getVictim(), SPELL_CLEAVE); + FireNova_Timer = 6000; Cleave_Timer = 8000; - } else Cleave_Timer -= diff; + Confliguration_Timer = 15000; + Thunderclap_Timer = 17000; + } - //Confliguration_Timer - if (Confliguration_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - DoCast(me->getVictim(), SPELL_CONFLIGURATION); - Confliguration_Timer = 18000; - } else Confliguration_Timer -= diff; + } - //Thunderclap_Timer - if (Thunderclap_Timer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_THUNDERCLAP); - Thunderclap_Timer = 20000; - } else Thunderclap_Timer -= diff; + //Return since we have no target + if (!UpdateVictim()) + return; + + //FireNova_Timer + if (FireNova_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_FIRENOVA); + FireNova_Timer = 10000; + } else FireNova_Timer -= diff; + + //Cleave_Timer + if (Cleave_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_CLEAVE); + Cleave_Timer = 8000; + } else Cleave_Timer -= diff; + + //Confliguration_Timer + if (Confliguration_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_CONFLIGURATION); + Confliguration_Timer = 18000; + } else Confliguration_Timer -= diff; + + //Thunderclap_Timer + if (Thunderclap_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_THUNDERCLAP); + Thunderclap_Timer = 20000; + } else Thunderclap_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_drakkisath(Creature* pCreature) -{ - return new boss_drakkisathAI (pCreature); -} void AddSC_boss_drakkisath() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_drakkisath"; - newscript->GetAI = &GetAI_boss_drakkisath; - newscript->RegisterSelf(); + new boss_drakkisath(); } - diff --git a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_gyth.cpp b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_gyth.cpp index 676115b0595..98ff410b90f 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_gyth.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_gyth.cpp @@ -28,180 +28,182 @@ EndScriptData */ #define SPELL_CORROSIVEACID 20667 #define SPELL_FREEZE 18763 #define SPELL_FLAMEBREATH 20712 - -struct boss_gythAI : public ScriptedAI +
class boss_gyth : public CreatureScript { - boss_gythAI(Creature *c) : ScriptedAI(c) {} - - uint32 Aggro_Timer; - uint32 Dragons_Timer; - uint32 Orc_Timer; - uint32 CorrosiveAcid_Timer; - uint32 Freeze_Timer; - uint32 Flamebreath_Timer; - uint32 Line1Count; - uint32 Line2Count; - - bool Event; - bool SummonedDragons; - bool SummonedOrcs; - bool SummonedRend; - bool bAggro; - bool RootSelf; - - void Reset() - { - Dragons_Timer = 3000; - Orc_Timer = 60000; - Aggro_Timer = 60000; - CorrosiveAcid_Timer = 8000; - Freeze_Timer = 11000; - Flamebreath_Timer = 4000; - Event = false; - SummonedDragons = false; - SummonedOrcs= false; - SummonedRend = false; - bAggro = false; - RootSelf = false; - - // how many times should the two lines of summoned creatures be spawned - // min 2 x 2, max 7 lines of attack in total - Line1Count = rand() % 4 + 2; - if (Line1Count < 5) - Line2Count = rand() % (5 - Line1Count) + 2; - else - Line2Count = 2; - - //Invisible for event start - me->SetDisplayId(11686); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - } +public: + boss_gyth() : CreatureScript("boss_gyth") { } - void EnterCombat(Unit * /*who*/) + CreatureAI* GetAI(Creature* pCreature) const { + return new boss_gythAI (pCreature); } - void SummonCreatureWithRandomTarget(uint32 creatureId) + struct boss_gythAI : public ScriptedAI { - Unit* Summoned = me->SummonCreature(creatureId, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 240000); - if (Summoned) + boss_gythAI(Creature *c) : ScriptedAI(c) {} + + uint32 Aggro_Timer; + uint32 Dragons_Timer; + uint32 Orc_Timer; + uint32 CorrosiveAcid_Timer; + uint32 Freeze_Timer; + uint32 Flamebreath_Timer; + uint32 Line1Count; + uint32 Line2Count; + + bool Event; + bool SummonedDragons; + bool SummonedOrcs; + bool SummonedRend; + bool bAggro; + bool RootSelf; + + void Reset() { - Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); - if (pTarget) - Summoned->AddThreat(pTarget, 1.0f); + Dragons_Timer = 3000; + Orc_Timer = 60000; + Aggro_Timer = 60000; + CorrosiveAcid_Timer = 8000; + Freeze_Timer = 11000; + Flamebreath_Timer = 4000; + Event = false; + SummonedDragons = false; + SummonedOrcs= false; + SummonedRend = false; + bAggro = false; + RootSelf = false; + + // how many times should the two lines of summoned creatures be spawned + // min 2 x 2, max 7 lines of attack in total + Line1Count = rand() % 4 + 2; + if (Line1Count < 5) + Line2Count = rand() % (5 - Line1Count) + 2; + else + Line2Count = 2; + + //Invisible for event start + me->SetDisplayId(11686); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); } - } - - void UpdateAI(const uint32 diff) - { - //char buf[200]; - //Return since we have no target - if (!UpdateVictim()) - return; - - if (!RootSelf) + void EnterCombat(Unit * /*who*/) { - //me->m_canMove = true; - DoCast(me, 33356); - RootSelf = true; } - if (!bAggro && Line1Count == 0 && Line2Count == 0) + void SummonCreatureWithRandomTarget(uint32 creatureId) { - if (Aggro_Timer <= diff) + Unit* Summoned = me->SummonCreature(creatureId, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 240000); + if (Summoned) { - bAggro = true; - // Visible now! - me->SetDisplayId(9723); - me->setFaction(14); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - } else Aggro_Timer -= diff; + Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); + if (pTarget) + Summoned->AddThreat(pTarget, 1.0f); + } } - // Summon Dragon pack. 2 Dragons and 3 Whelps - if (!bAggro && !SummonedRend && Line1Count > 0) + void UpdateAI(const uint32 diff) { - if (Dragons_Timer <= diff) - { - SummonCreatureWithRandomTarget(10372); - SummonCreatureWithRandomTarget(10372); - SummonCreatureWithRandomTarget(10442); - SummonCreatureWithRandomTarget(10442); - SummonCreatureWithRandomTarget(10442); - Line1Count = Line1Count - 1; - Dragons_Timer = 60000; - } else Dragons_Timer -= diff; - } + //char buf[200]; - //Summon Orc pack. 1 Orc Handler 1 Elite Dragonkin and 3 Whelps - if (!bAggro && !SummonedRend && Line1Count == 0 && Line2Count > 0) - { - if (Orc_Timer <= diff) - { - SummonCreatureWithRandomTarget(10447); - SummonCreatureWithRandomTarget(10317); - SummonCreatureWithRandomTarget(10442); - SummonCreatureWithRandomTarget(10442); - SummonCreatureWithRandomTarget(10442); - Line2Count = Line2Count - 1; - Orc_Timer = 60000; - } else Orc_Timer -= diff; - } + //Return since we have no target + if (!UpdateVictim()) + return; - // we take part in the fight - if (bAggro) - { - // CorrosiveAcid_Timer - if (CorrosiveAcid_Timer <= diff) + if (!RootSelf) { - DoCast(me->getVictim(), SPELL_CORROSIVEACID); - CorrosiveAcid_Timer = 7000; - } else CorrosiveAcid_Timer -= diff; + //me->m_canMove = true; + DoCast(me, 33356); + RootSelf = true; + } - // Freeze_Timer - if (Freeze_Timer <= diff) + if (!bAggro && Line1Count == 0 && Line2Count == 0) { - DoCast(me->getVictim(), SPELL_FREEZE); - Freeze_Timer = 16000; - } else Freeze_Timer -= diff; + if (Aggro_Timer <= diff) + { + bAggro = true; + // Visible now! + me->SetDisplayId(9723); + me->setFaction(14); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + } else Aggro_Timer -= diff; + } - // Flamebreath_Timer - if (Flamebreath_Timer <= diff) + // Summon Dragon pack. 2 Dragons and 3 Whelps + if (!bAggro && !SummonedRend && Line1Count > 0) { - DoCast(me->getVictim(), SPELL_FLAMEBREATH); - Flamebreath_Timer = 10500; - } else Flamebreath_Timer -= diff; + if (Dragons_Timer <= diff) + { + SummonCreatureWithRandomTarget(10372); + SummonCreatureWithRandomTarget(10372); + SummonCreatureWithRandomTarget(10442); + SummonCreatureWithRandomTarget(10442); + SummonCreatureWithRandomTarget(10442); + Line1Count = Line1Count - 1; + Dragons_Timer = 60000; + } else Dragons_Timer -= diff; + } - //Summon Rend - if (!SummonedRend && me->GetHealth()*100 / me->GetMaxHealth() < 11 - && me->GetHealth() > 0) + //Summon Orc pack. 1 Orc Handler 1 Elite Dragonkin and 3 Whelps + if (!bAggro && !SummonedRend && Line1Count == 0 && Line2Count > 0) { - //summon Rend and Change model to normal Gyth - //Interrupt any spell casting - me->InterruptNonMeleeSpells(false); - //Gyth model - me->SetDisplayId(9806); - me->SummonCreature(10429, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 900000); - SummonedRend = true; + if (Orc_Timer <= diff) + { + SummonCreatureWithRandomTarget(10447); + SummonCreatureWithRandomTarget(10317); + SummonCreatureWithRandomTarget(10442); + SummonCreatureWithRandomTarget(10442); + SummonCreatureWithRandomTarget(10442); + Line2Count = Line2Count - 1; + Orc_Timer = 60000; + } else Orc_Timer -= diff; } - DoMeleeAttackIfReady(); - } // end if Aggro - } + // we take part in the fight + if (bAggro) + { + // CorrosiveAcid_Timer + if (CorrosiveAcid_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_CORROSIVEACID); + CorrosiveAcid_Timer = 7000; + } else CorrosiveAcid_Timer -= diff; + + // Freeze_Timer + if (Freeze_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_FREEZE); + Freeze_Timer = 16000; + } else Freeze_Timer -= diff; + + // Flamebreath_Timer + if (Flamebreath_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_FLAMEBREATH); + Flamebreath_Timer = 10500; + } else Flamebreath_Timer -= diff; + + //Summon Rend + if (!SummonedRend && me->GetHealth()*100 / me->GetMaxHealth() < 11 + && me->GetHealth() > 0) + { + //summon Rend and Change model to normal Gyth + //Interrupt any spell casting + me->InterruptNonMeleeSpells(false); + //Gyth model + me->SetDisplayId(9806); + me->SummonCreature(10429, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 900000); + SummonedRend = true; + } + + DoMeleeAttackIfReady(); + } // end if Aggro + } + }; + }; -CreatureAI* GetAI_boss_gyth(Creature* pCreature) -{ - return new boss_gythAI (pCreature); -} void AddSC_boss_gyth() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_gyth"; - newscript->GetAI = &GetAI_boss_gyth; - newscript->RegisterSelf(); + new boss_gyth(); } - diff --git a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_halycon.cpp b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_halycon.cpp index 679ec4d37a0..03776a564b1 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_halycon.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_halycon.cpp @@ -32,67 +32,69 @@ EndScriptData */ #define ADD_1Y -324.961395 #define ADD_1Z 64.401443 #define ADD_1O 3.124724 - -struct boss_halyconAI : public ScriptedAI +
class boss_halycon : public CreatureScript { - boss_halyconAI(Creature *c) : ScriptedAI(c) {} - - uint32 CrowdPummel_Timer; - uint32 MightyBlow_Timer; - bool Summoned; +public: + boss_halycon() : CreatureScript("boss_halycon") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - CrowdPummel_Timer = 8000; - MightyBlow_Timer = 14000; - Summoned = false; + return new boss_halyconAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_halyconAI : public ScriptedAI { - } + boss_halyconAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + uint32 CrowdPummel_Timer; + uint32 MightyBlow_Timer; + bool Summoned; - //CrowdPummel_Timer - if (CrowdPummel_Timer <= diff) + void Reset() { - DoCast(me->getVictim(), SPELL_CROWDPUMMEL); - CrowdPummel_Timer = 14000; - } else CrowdPummel_Timer -= diff; + CrowdPummel_Timer = 8000; + MightyBlow_Timer = 14000; + Summoned = false; + } - //MightyBlow_Timer - if (MightyBlow_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - DoCast(me->getVictim(), SPELL_MIGHTYBLOW); - MightyBlow_Timer = 10000; - } else MightyBlow_Timer -= diff; + } - //Summon Gizrul - if (!Summoned && me->GetHealth()*100 / me->GetMaxHealth() < 25) + void UpdateAI(const uint32 diff) { - me->SummonCreature(10268,ADD_1X,ADD_1Y,ADD_1Z,ADD_1O,TEMPSUMMON_TIMED_DESPAWN,300000); - Summoned = true; + //Return since we have no target + if (!UpdateVictim()) + return; + + //CrowdPummel_Timer + if (CrowdPummel_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_CROWDPUMMEL); + CrowdPummel_Timer = 14000; + } else CrowdPummel_Timer -= diff; + + //MightyBlow_Timer + if (MightyBlow_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_MIGHTYBLOW); + MightyBlow_Timer = 10000; + } else MightyBlow_Timer -= diff; + + //Summon Gizrul + if (!Summoned && me->GetHealth()*100 / me->GetMaxHealth() < 25) + { + me->SummonCreature(10268,ADD_1X,ADD_1Y,ADD_1Z,ADD_1O,TEMPSUMMON_TIMED_DESPAWN,300000); + Summoned = true; + } + + DoMeleeAttackIfReady(); } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_halycon(Creature* pCreature) -{ - return new boss_halyconAI (pCreature); -} void AddSC_boss_halycon() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_halycon"; - newscript->GetAI = &GetAI_boss_halycon; - newscript->RegisterSelf(); + new boss_halycon(); } - diff --git a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_highlord_omokk.cpp b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_highlord_omokk.cpp index 1b40580572b..759cafb0a0f 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_highlord_omokk.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_highlord_omokk.cpp @@ -32,103 +32,105 @@ EndScriptData */ #define SPELL_SUNDERARMOR 24317 #define SPELL_KNOCKAWAY 20686 #define SPELL_SLOW 22356 - -struct boss_highlordomokkAI : public ScriptedAI +
class boss_highlord_omokk : public CreatureScript { - boss_highlordomokkAI(Creature *c) : ScriptedAI(c) {} - - uint32 WarStomp_Timer; - uint32 Cleave_Timer; - uint32 Strike_Timer; - uint32 Rend_Timer; - uint32 SunderArmor_Timer; - uint32 KnockAway_Timer; - uint32 Slow_Timer; - - void Reset() - { - WarStomp_Timer = 15000; - Cleave_Timer = 6000; - Strike_Timer = 10000; - Rend_Timer = 14000; - SunderArmor_Timer = 2000; - KnockAway_Timer = 18000; - Slow_Timer = 24000; - } +public: + boss_highlord_omokk() : CreatureScript("boss_highlord_omokk") { } - void EnterCombat(Unit * /*who*/) + CreatureAI* GetAI(Creature* pCreature) const { + return new boss_highlordomokkAI (pCreature); } - void UpdateAI(const uint32 diff) + struct boss_highlordomokkAI : public ScriptedAI { - //Return since we have no target - if (!UpdateVictim()) - return; - - //WarStomp_Timer - if (WarStomp_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_WARSTOMP); - WarStomp_Timer = 14000; - } else WarStomp_Timer -= diff; + boss_highlordomokkAI(Creature *c) : ScriptedAI(c) {} - //Cleave_Timer - if (Cleave_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_CLEAVE); - Cleave_Timer = 8000; - } else Cleave_Timer -= diff; + uint32 WarStomp_Timer; + uint32 Cleave_Timer; + uint32 Strike_Timer; + uint32 Rend_Timer; + uint32 SunderArmor_Timer; + uint32 KnockAway_Timer; + uint32 Slow_Timer; - //Strike_Timer - if (Strike_Timer <= diff) + void Reset() { - DoCast(me->getVictim(), SPELL_STRIKE); + WarStomp_Timer = 15000; + Cleave_Timer = 6000; Strike_Timer = 10000; - } else Strike_Timer -= diff; + Rend_Timer = 14000; + SunderArmor_Timer = 2000; + KnockAway_Timer = 18000; + Slow_Timer = 24000; + } - //Rend_Timer - if (Rend_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - DoCast(me->getVictim(), SPELL_REND); - Rend_Timer = 18000; - } else Rend_Timer -= diff; + } - //SunderArmor_Timer - if (SunderArmor_Timer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_SUNDERARMOR); - SunderArmor_Timer = 25000; - } else SunderArmor_Timer -= diff; + //Return since we have no target + if (!UpdateVictim()) + return; + + //WarStomp_Timer + if (WarStomp_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_WARSTOMP); + WarStomp_Timer = 14000; + } else WarStomp_Timer -= diff; + + //Cleave_Timer + if (Cleave_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_CLEAVE); + Cleave_Timer = 8000; + } else Cleave_Timer -= diff; + + //Strike_Timer + if (Strike_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_STRIKE); + Strike_Timer = 10000; + } else Strike_Timer -= diff; + + //Rend_Timer + if (Rend_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_REND); + Rend_Timer = 18000; + } else Rend_Timer -= diff; + + //SunderArmor_Timer + if (SunderArmor_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_SUNDERARMOR); + SunderArmor_Timer = 25000; + } else SunderArmor_Timer -= diff; + + //KnockAway_Timer + if (KnockAway_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_KNOCKAWAY); + KnockAway_Timer = 12000; + } else KnockAway_Timer -= diff; + + //Slow_Timer + if (Slow_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_SLOW); + Slow_Timer = 18000; + } else Slow_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - //KnockAway_Timer - if (KnockAway_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_KNOCKAWAY); - KnockAway_Timer = 12000; - } else KnockAway_Timer -= diff; - - //Slow_Timer - if (Slow_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_SLOW); - Slow_Timer = 18000; - } else Slow_Timer -= diff; - - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_highlordomokk(Creature* pCreature) -{ - return new boss_highlordomokkAI (pCreature); -} void AddSC_boss_highlordomokk() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_highlord_omokk"; - newscript->GetAI = &GetAI_boss_highlordomokk; - newscript->RegisterSelf(); + new boss_highlord_omokk(); } - diff --git a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_mother_smolderweb.cpp b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_mother_smolderweb.cpp index 1f7d9d1dd18..8b41258ed0f 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_mother_smolderweb.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_mother_smolderweb.cpp @@ -28,62 +28,64 @@ EndScriptData */ #define SPELL_CRYSTALIZE 16104 #define SPELL_MOTHERSMILK 16468 #define SPELL_SUMMON_SPIRE_SPIDERLING 16103 - -struct boss_mothersmolderwebAI : public ScriptedAI +
class boss_mother_smolderweb : public CreatureScript { - boss_mothersmolderwebAI(Creature *c) : ScriptedAI(c) {} - - uint32 Crystalize_Timer; - uint32 MothersMilk_Timer; +public: + boss_mother_smolderweb() : CreatureScript("boss_mother_smolderweb") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - Crystalize_Timer = 20000; - MothersMilk_Timer = 10000; + return new boss_mothersmolderwebAI (pCreature); } - void EnterCombat(Unit * /*who*/) {} - - void DamageTaken(Unit * /*done_by*/, uint32 &damage) + struct boss_mothersmolderwebAI : public ScriptedAI { - if (me->GetHealth() <= damage) - DoCast(me, SPELL_SUMMON_SPIRE_SPIDERLING, true); - } + boss_mothersmolderwebAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + uint32 Crystalize_Timer; + uint32 MothersMilk_Timer; - //Crystalize_Timer - if (Crystalize_Timer <= diff) + void Reset() { - DoCast(me, SPELL_CRYSTALIZE); - Crystalize_Timer = 15000; - } else Crystalize_Timer -= diff; + Crystalize_Timer = 20000; + MothersMilk_Timer = 10000; + } + + void EnterCombat(Unit * /*who*/) {} - //MothersMilk_Timer - if (MothersMilk_Timer <= diff) + void DamageTaken(Unit * /*done_by*/, uint32 &damage) { - DoCast(me, SPELL_MOTHERSMILK); - MothersMilk_Timer = urand(5000,12500); - } else MothersMilk_Timer -= diff; + if (me->GetHealth() <= damage) + DoCast(me, SPELL_SUMMON_SPIRE_SPIDERLING, true); + } + + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + //Crystalize_Timer + if (Crystalize_Timer <= diff) + { + DoCast(me, SPELL_CRYSTALIZE); + Crystalize_Timer = 15000; + } else Crystalize_Timer -= diff; + + //MothersMilk_Timer + if (MothersMilk_Timer <= diff) + { + DoCast(me, SPELL_MOTHERSMILK); + MothersMilk_Timer = urand(5000,12500); + } else MothersMilk_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_mothersmolderweb(Creature* pCreature) -{ - return new boss_mothersmolderwebAI (pCreature); -} void AddSC_boss_mothersmolderweb() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_mother_smolderweb"; - newscript->GetAI = &GetAI_boss_mothersmolderweb; - newscript->RegisterSelf(); + new boss_mother_smolderweb(); } - diff --git a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_overlord_wyrmthalak.cpp b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_overlord_wyrmthalak.cpp index dd93ef85325..a1b87b42280 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_overlord_wyrmthalak.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_overlord_wyrmthalak.cpp @@ -39,90 +39,92 @@ EndScriptData */ #define ADD_2Y -511.896942 #define ADD_2Z 88.195160 #define ADD_2O 4.613114 - -struct boss_overlordwyrmthalakAI : public ScriptedAI +
class boss_overlord_wyrmthalak : public CreatureScript { - boss_overlordwyrmthalakAI(Creature *c) : ScriptedAI(c) {} - - uint32 BlastWave_Timer; - uint32 Shout_Timer; - uint32 Cleave_Timer; - uint32 Knockaway_Timer; - bool Summoned; +public: + boss_overlord_wyrmthalak() : CreatureScript("boss_overlord_wyrmthalak") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - BlastWave_Timer = 20000; - Shout_Timer = 2000; - Cleave_Timer = 6000; - Knockaway_Timer = 12000; - Summoned = false; + return new boss_overlordwyrmthalakAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_overlordwyrmthalakAI : public ScriptedAI { - } + boss_overlordwyrmthalakAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + uint32 BlastWave_Timer; + uint32 Shout_Timer; + uint32 Cleave_Timer; + uint32 Knockaway_Timer; + bool Summoned; - //BlastWave_Timer - if (BlastWave_Timer <= diff) + void Reset() { - DoCast(me->getVictim(), SPELL_BLASTWAVE); BlastWave_Timer = 20000; - } else BlastWave_Timer -= diff; - - //Shout_Timer - if (Shout_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_SHOUT); - Shout_Timer = 10000; - } else Shout_Timer -= diff; - - //Cleave_Timer - if (Cleave_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_CLEAVE); - Cleave_Timer = 7000; - } else Cleave_Timer -= diff; + Shout_Timer = 2000; + Cleave_Timer = 6000; + Knockaway_Timer = 12000; + Summoned = false; + } - //Knockaway_Timer - if (Knockaway_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - DoCast(me->getVictim(), SPELL_KNOCKAWAY); - Knockaway_Timer = 14000; - } else Knockaway_Timer -= diff; + } - //Summon two Beserks - if (!Summoned && me->GetHealth()*100 / me->GetMaxHealth() < 51) + void UpdateAI(const uint32 diff) { - Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM,0, 100, true); - - if (Creature *SummonedCreature = me->SummonCreature(9216,ADD_1X,ADD_1Y,ADD_1Z,ADD_1O,TEMPSUMMON_TIMED_DESPAWN,300000)) - SummonedCreature->AI()->AttackStart(pTarget); - if (Creature *SummonedCreature = me->SummonCreature(9268,ADD_2X,ADD_2Y,ADD_2Z,ADD_2O,TEMPSUMMON_TIMED_DESPAWN,300000)) - SummonedCreature->AI()->AttackStart(pTarget); - Summoned = true; + //Return since we have no target + if (!UpdateVictim()) + return; + + //BlastWave_Timer + if (BlastWave_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_BLASTWAVE); + BlastWave_Timer = 20000; + } else BlastWave_Timer -= diff; + + //Shout_Timer + if (Shout_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_SHOUT); + Shout_Timer = 10000; + } else Shout_Timer -= diff; + + //Cleave_Timer + if (Cleave_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_CLEAVE); + Cleave_Timer = 7000; + } else Cleave_Timer -= diff; + + //Knockaway_Timer + if (Knockaway_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_KNOCKAWAY); + Knockaway_Timer = 14000; + } else Knockaway_Timer -= diff; + + //Summon two Beserks + if (!Summoned && me->GetHealth()*100 / me->GetMaxHealth() < 51) + { + Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM,0, 100, true); + + if (Creature *SummonedCreature = me->SummonCreature(9216,ADD_1X,ADD_1Y,ADD_1Z,ADD_1O,TEMPSUMMON_TIMED_DESPAWN,300000)) + SummonedCreature->AI()->AttackStart(pTarget); + if (Creature *SummonedCreature = me->SummonCreature(9268,ADD_2X,ADD_2Y,ADD_2Z,ADD_2O,TEMPSUMMON_TIMED_DESPAWN,300000)) + SummonedCreature->AI()->AttackStart(pTarget); + Summoned = true; + } + + DoMeleeAttackIfReady(); } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_overlordwyrmthalak(Creature* pCreature) -{ - return new boss_overlordwyrmthalakAI (pCreature); -} void AddSC_boss_overlordwyrmthalak() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_overlord_wyrmthalak"; - newscript->GetAI = &GetAI_boss_overlordwyrmthalak; - newscript->RegisterSelf(); + new boss_overlord_wyrmthalak(); } - diff --git a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_pyroguard_emberseer.cpp b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_pyroguard_emberseer.cpp index 267a590a307..eb9b52cb06a 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_pyroguard_emberseer.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_pyroguard_emberseer.cpp @@ -28,68 +28,70 @@ EndScriptData */ #define SPELL_FIRENOVA 23462 #define SPELL_FLAMEBUFFET 23341 #define SPELL_PYROBLAST 17274 - -struct boss_pyroguard_emberseerAI : public ScriptedAI +
class boss_pyroguard_emberseer : public CreatureScript { - boss_pyroguard_emberseerAI(Creature *c) : ScriptedAI(c) {} - - uint32 FireNova_Timer; - uint32 FlameBuffet_Timer; - uint32 PyroBlast_Timer; +public: + boss_pyroguard_emberseer() : CreatureScript("boss_pyroguard_emberseer") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - FireNova_Timer = 6000; - FlameBuffet_Timer = 3000; - PyroBlast_Timer = 14000; + return new boss_pyroguard_emberseerAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_pyroguard_emberseerAI : public ScriptedAI { - } + boss_pyroguard_emberseerAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + uint32 FireNova_Timer; + uint32 FlameBuffet_Timer; + uint32 PyroBlast_Timer; - //FireNova_Timer - if (FireNova_Timer <= diff) + void Reset() { - DoCast(me->getVictim(), SPELL_FIRENOVA); FireNova_Timer = 6000; - } else FireNova_Timer -= diff; + FlameBuffet_Timer = 3000; + PyroBlast_Timer = 14000; + } - //FlameBuffet_Timer - if (FlameBuffet_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - DoCast(me->getVictim(), SPELL_FLAMEBUFFET); - FlameBuffet_Timer = 14000; - } else FlameBuffet_Timer -= diff; + } - //PyroBlast_Timer - if (PyroBlast_Timer <= diff) + void UpdateAI(const uint32 diff) { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(pTarget, SPELL_PYROBLAST); - PyroBlast_Timer = 15000; - } else PyroBlast_Timer -= diff; + //Return since we have no target + if (!UpdateVictim()) + return; + + //FireNova_Timer + if (FireNova_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_FIRENOVA); + FireNova_Timer = 6000; + } else FireNova_Timer -= diff; + + //FlameBuffet_Timer + if (FlameBuffet_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_FLAMEBUFFET); + FlameBuffet_Timer = 14000; + } else FlameBuffet_Timer -= diff; + + //PyroBlast_Timer + if (PyroBlast_Timer <= diff) + { + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + DoCast(pTarget, SPELL_PYROBLAST); + PyroBlast_Timer = 15000; + } else PyroBlast_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_pyroguard_emberseer(Creature* pCreature) -{ - return new boss_pyroguard_emberseerAI (pCreature); -} void AddSC_boss_pyroguard_emberseer() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_pyroguard_emberseer"; - newscript->GetAI = &GetAI_boss_pyroguard_emberseer; - newscript->RegisterSelf(); + new boss_pyroguard_emberseer(); } - diff --git a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_quartermaster_zigris.cpp b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_quartermaster_zigris.cpp index 4d46394a536..a8e2794cb46 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_quartermaster_zigris.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_quartermaster_zigris.cpp @@ -29,60 +29,62 @@ EndScriptData */ #define SPELL_STUNBOMB 16497 #define SPELL_HEALING_POTION 15504 #define SPELL_HOOKEDNET 15609 - -struct boss_quatermasterzigrisAI : public ScriptedAI +
class quartermaster_zigris : public CreatureScript { - boss_quatermasterzigrisAI(Creature *c) : ScriptedAI(c) {} - - uint32 Shoot_Timer; - uint32 StunBomb_Timer; - //uint32 HelingPotion_Timer; +public: + quartermaster_zigris() : CreatureScript("quartermaster_zigris") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - Shoot_Timer = 1000; - StunBomb_Timer = 16000; - //HelingPotion_Timer = 25000; + return new boss_quatermasterzigrisAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_quatermasterzigrisAI : public ScriptedAI { - } + boss_quatermasterzigrisAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + uint32 Shoot_Timer; + uint32 StunBomb_Timer; + //uint32 HelingPotion_Timer; - //Shoot_Timer - if (Shoot_Timer <= diff) + void Reset() { - DoCast(me->getVictim(), SPELL_SHOOT); - Shoot_Timer = 500; - } else Shoot_Timer -= diff; + Shoot_Timer = 1000; + StunBomb_Timer = 16000; + //HelingPotion_Timer = 25000; + } - //StunBomb_Timer - if (StunBomb_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - DoCast(me->getVictim(), SPELL_STUNBOMB); - StunBomb_Timer = 14000; - } else StunBomb_Timer -= diff; + } + + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + //Shoot_Timer + if (Shoot_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_SHOOT); + Shoot_Timer = 500; + } else Shoot_Timer -= diff; + + //StunBomb_Timer + if (StunBomb_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_STUNBOMB); + StunBomb_Timer = 14000; + } else StunBomb_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_quatermasterzigris(Creature* pCreature) -{ - return new boss_quatermasterzigrisAI (pCreature); -} void AddSC_boss_quatermasterzigris() { - Script *newscript; - newscript = new Script; - newscript->Name = "quartermaster_zigris"; - newscript->GetAI = &GetAI_boss_quatermasterzigris; - newscript->RegisterSelf(); + new quartermaster_zigris(); } - diff --git a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_rend_blackhand.cpp b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_rend_blackhand.cpp index 4973246df79..95791197c9a 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_rend_blackhand.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_rend_blackhand.cpp @@ -28,67 +28,69 @@ EndScriptData */ #define SPELL_WHIRLWIND 26038 #define SPELL_CLEAVE 20691 #define SPELL_THUNDERCLAP 23931 //Not sure if he cast this spell - -struct boss_rend_blackhandAI : public ScriptedAI +
class boss_rend_blackhand : public CreatureScript { - boss_rend_blackhandAI(Creature *c) : ScriptedAI(c) {} - - uint32 WhirlWind_Timer; - uint32 Cleave_Timer; - uint32 Thunderclap_Timer; +public: + boss_rend_blackhand() : CreatureScript("boss_rend_blackhand") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - WhirlWind_Timer = 20000; - Cleave_Timer = 5000; - Thunderclap_Timer = 9000; + return new boss_rend_blackhandAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_rend_blackhandAI : public ScriptedAI { - } + boss_rend_blackhandAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + uint32 WhirlWind_Timer; + uint32 Cleave_Timer; + uint32 Thunderclap_Timer; - //WhirlWind_Timer - if (WhirlWind_Timer <= diff) + void Reset() { - DoCast(me->getVictim(), SPELL_WHIRLWIND); - WhirlWind_Timer = 18000; - } else WhirlWind_Timer -= diff; + WhirlWind_Timer = 20000; + Cleave_Timer = 5000; + Thunderclap_Timer = 9000; + } - //Cleave_Timer - if (Cleave_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - DoCast(me->getVictim(), SPELL_CLEAVE); - Cleave_Timer = 10000; - } else Cleave_Timer -= diff; + } - //Thunderclap_Timer - if (Thunderclap_Timer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_THUNDERCLAP); - Thunderclap_Timer = 16000; - } else Thunderclap_Timer -= diff; + //Return since we have no target + if (!UpdateVictim()) + return; + + //WhirlWind_Timer + if (WhirlWind_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_WHIRLWIND); + WhirlWind_Timer = 18000; + } else WhirlWind_Timer -= diff; + + //Cleave_Timer + if (Cleave_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_CLEAVE); + Cleave_Timer = 10000; + } else Cleave_Timer -= diff; + + //Thunderclap_Timer + if (Thunderclap_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_THUNDERCLAP); + Thunderclap_Timer = 16000; + } else Thunderclap_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_rend_blackhand(Creature* pCreature) -{ - return new boss_rend_blackhandAI (pCreature); -} void AddSC_boss_rend_blackhand() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_rend_blackhand"; - newscript->GetAI = &GetAI_boss_rend_blackhand; - newscript->RegisterSelf(); + new boss_rend_blackhand(); } - diff --git a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_shadow_hunter_voshgajin.cpp b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_shadow_hunter_voshgajin.cpp index b3470b43e21..5afe8585f9e 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_shadow_hunter_voshgajin.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_shadow_hunter_voshgajin.cpp @@ -28,68 +28,70 @@ EndScriptData */ #define SPELL_CURSEOFBLOOD 24673 #define SPELL_HEX 16708 #define SPELL_CLEAVE 20691 - -struct boss_shadowvoshAI : public ScriptedAI +
class boss_shadow_hunter_voshgajin : public CreatureScript { - boss_shadowvoshAI(Creature *c) : ScriptedAI(c) {} - - uint32 CurseOfBlood_Timer; - uint32 Hex_Timer; - uint32 Cleave_Timer; +public: + boss_shadow_hunter_voshgajin() : CreatureScript("boss_shadow_hunter_voshgajin") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - CurseOfBlood_Timer = 2000; - Hex_Timer = 8000; - Cleave_Timer = 14000; - - //DoCast(me, SPELL_ICEARMOR, true); + return new boss_shadowvoshAI (pCreature); } - void EnterCombat(Unit * /*who*/){} - - void UpdateAI(const uint32 diff) + struct boss_shadowvoshAI : public ScriptedAI { - //Return since we have no target - if (!UpdateVictim()) - return; + boss_shadowvoshAI(Creature *c) : ScriptedAI(c) {} - //CurseOfBlood_Timer - if (CurseOfBlood_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_CURSEOFBLOOD); - CurseOfBlood_Timer = 45000; - } else CurseOfBlood_Timer -= diff; + uint32 CurseOfBlood_Timer; + uint32 Hex_Timer; + uint32 Cleave_Timer; - //Hex_Timer - if (Hex_Timer <= diff) + void Reset() { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(pTarget, SPELL_HEX); - Hex_Timer = 15000; - } else Hex_Timer -= diff; + CurseOfBlood_Timer = 2000; + Hex_Timer = 8000; + Cleave_Timer = 14000; + + //DoCast(me, SPELL_ICEARMOR, true); + } - //Cleave_Timer - if (Cleave_Timer <= diff) + void EnterCombat(Unit * /*who*/){} + + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_CLEAVE); - Cleave_Timer = 7000; - } else Cleave_Timer -= diff; + //Return since we have no target + if (!UpdateVictim()) + return; + + //CurseOfBlood_Timer + if (CurseOfBlood_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_CURSEOFBLOOD); + CurseOfBlood_Timer = 45000; + } else CurseOfBlood_Timer -= diff; + + //Hex_Timer + if (Hex_Timer <= diff) + { + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + DoCast(pTarget, SPELL_HEX); + Hex_Timer = 15000; + } else Hex_Timer -= diff; + + //Cleave_Timer + if (Cleave_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_CLEAVE); + Cleave_Timer = 7000; + } else Cleave_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_shadowvosh(Creature* pCreature) -{ - return new boss_shadowvoshAI (pCreature); -} void AddSC_boss_shadowvosh() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_shadow_hunter_voshgajin"; - newscript->GetAI = &GetAI_boss_shadowvosh; - newscript->RegisterSelf(); + new boss_shadow_hunter_voshgajin(); } - diff --git a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_the_beast.cpp b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_the_beast.cpp index 4af0dbc3a73..53abc0d1d65 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_the_beast.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_the_beast.cpp @@ -28,68 +28,70 @@ EndScriptData */ #define SPELL_FLAMEBREAK 16785 #define SPELL_IMMOLATE 20294 #define SPELL_TERRIFYINGROAR 14100 - -struct boss_thebeastAI : public ScriptedAI +
class boss_the_beast : public CreatureScript { - boss_thebeastAI(Creature *c) : ScriptedAI(c) {} - - uint32 Flamebreak_Timer; - uint32 Immolate_Timer; - uint32 TerrifyingRoar_Timer; +public: + boss_the_beast() : CreatureScript("boss_the_beast") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - Flamebreak_Timer = 12000; - Immolate_Timer = 3000; - TerrifyingRoar_Timer = 23000; + return new boss_thebeastAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_thebeastAI : public ScriptedAI { - } + boss_thebeastAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + uint32 Flamebreak_Timer; + uint32 Immolate_Timer; + uint32 TerrifyingRoar_Timer; - //Flamebreak_Timer - if (Flamebreak_Timer <= diff) + void Reset() { - DoCast(me->getVictim(), SPELL_FLAMEBREAK); - Flamebreak_Timer = 10000; - } else Flamebreak_Timer -= diff; + Flamebreak_Timer = 12000; + Immolate_Timer = 3000; + TerrifyingRoar_Timer = 23000; + } - //Immolate_Timer - if (Immolate_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(pTarget, SPELL_IMMOLATE); - Immolate_Timer = 8000; - } else Immolate_Timer -= diff; + } - //TerrifyingRoar_Timer - if (TerrifyingRoar_Timer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_TERRIFYINGROAR); - TerrifyingRoar_Timer = 20000; - } else TerrifyingRoar_Timer -= diff; + //Return since we have no target + if (!UpdateVictim()) + return; + + //Flamebreak_Timer + if (Flamebreak_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_FLAMEBREAK); + Flamebreak_Timer = 10000; + } else Flamebreak_Timer -= diff; + + //Immolate_Timer + if (Immolate_Timer <= diff) + { + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + DoCast(pTarget, SPELL_IMMOLATE); + Immolate_Timer = 8000; + } else Immolate_Timer -= diff; + + //TerrifyingRoar_Timer + if (TerrifyingRoar_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_TERRIFYINGROAR); + TerrifyingRoar_Timer = 20000; + } else TerrifyingRoar_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_thebeast(Creature* pCreature) -{ - return new boss_thebeastAI (pCreature); -} void AddSC_boss_thebeast() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_the_beast"; - newscript->GetAI = &GetAI_boss_thebeast; - newscript->RegisterSelf(); + new boss_the_beast(); } - diff --git a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_warmaster_voone.cpp b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_warmaster_voone.cpp index 7e05dec67cf..b0c7cd81f7a 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_warmaster_voone.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_warmaster_voone.cpp @@ -31,94 +31,96 @@ EndScriptData */ #define SPELL_MORTALSTRIKE 16856 #define SPELL_PUMMEL 15615 #define SPELL_THROWAXE 16075 - -struct boss_warmastervooneAI : public ScriptedAI +
class boss_warmaster_voone : public CreatureScript { - boss_warmastervooneAI(Creature *c) : ScriptedAI(c) {} - - uint32 Snapkick_Timer; - uint32 Cleave_Timer; - uint32 Uppercut_Timer; - uint32 MortalStrike_Timer; - uint32 Pummel_Timer; - uint32 ThrowAxe_Timer; - - void Reset() - { - Snapkick_Timer = 8000; - Cleave_Timer = 14000; - Uppercut_Timer = 20000; - MortalStrike_Timer = 12000; - Pummel_Timer = 32000; - ThrowAxe_Timer = 1000; - } +public: + boss_warmaster_voone() : CreatureScript("boss_warmaster_voone") { } - void EnterCombat(Unit * /*who*/) + CreatureAI* GetAI(Creature* pCreature) const { + return new boss_warmastervooneAI (pCreature); } - void UpdateAI(const uint32 diff) + struct boss_warmastervooneAI : public ScriptedAI { - //Return since we have no target - if (!UpdateVictim()) - return; + boss_warmastervooneAI(Creature *c) : ScriptedAI(c) {} - //Snapkick_Timer - if (Snapkick_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_SNAPKICK); - Snapkick_Timer = 6000; - } else Snapkick_Timer -= diff; + uint32 Snapkick_Timer; + uint32 Cleave_Timer; + uint32 Uppercut_Timer; + uint32 MortalStrike_Timer; + uint32 Pummel_Timer; + uint32 ThrowAxe_Timer; - //Cleave_Timer - if (Cleave_Timer <= diff) + void Reset() { - DoCast(me->getVictim(), SPELL_CLEAVE); - Cleave_Timer = 12000; - } else Cleave_Timer -= diff; - - //Uppercut_Timer - if (Uppercut_Timer <= diff) + Snapkick_Timer = 8000; + Cleave_Timer = 14000; + Uppercut_Timer = 20000; + MortalStrike_Timer = 12000; + Pummel_Timer = 32000; + ThrowAxe_Timer = 1000; + } + + void EnterCombat(Unit * /*who*/) { - DoCast(me->getVictim(), SPELL_UPPERCUT); - Uppercut_Timer = 14000; - } else Uppercut_Timer -= diff; + } - //MortalStrike_Timer - if (MortalStrike_Timer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_MORTALSTRIKE); - MortalStrike_Timer = 10000; - } else MortalStrike_Timer -= diff; + //Return since we have no target + if (!UpdateVictim()) + return; + + //Snapkick_Timer + if (Snapkick_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_SNAPKICK); + Snapkick_Timer = 6000; + } else Snapkick_Timer -= diff; + + //Cleave_Timer + if (Cleave_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_CLEAVE); + Cleave_Timer = 12000; + } else Cleave_Timer -= diff; + + //Uppercut_Timer + if (Uppercut_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_UPPERCUT); + Uppercut_Timer = 14000; + } else Uppercut_Timer -= diff; + + //MortalStrike_Timer + if (MortalStrike_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_MORTALSTRIKE); + MortalStrike_Timer = 10000; + } else MortalStrike_Timer -= diff; + + //Pummel_Timer + if (Pummel_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_PUMMEL); + Pummel_Timer = 16000; + } else Pummel_Timer -= diff; + + //ThrowAxe_Timer + if (ThrowAxe_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_THROWAXE); + ThrowAxe_Timer = 8000; + } else ThrowAxe_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - //Pummel_Timer - if (Pummel_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_PUMMEL); - Pummel_Timer = 16000; - } else Pummel_Timer -= diff; - - //ThrowAxe_Timer - if (ThrowAxe_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_THROWAXE); - ThrowAxe_Timer = 8000; - } else ThrowAxe_Timer -= diff; - - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_warmastervoone(Creature* pCreature) -{ - return new boss_warmastervooneAI (pCreature); -} void AddSC_boss_warmastervoone() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_warmaster_voone"; - newscript->GetAI = &GetAI_boss_warmastervoone; - newscript->RegisterSelf(); + new boss_warmaster_voone(); } - diff --git a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_broodlord_lashlayer.cpp b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_broodlord_lashlayer.cpp index 33e0ff49e5a..131e1cd88d9 100644 --- a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_broodlord_lashlayer.cpp +++ b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_broodlord_lashlayer.cpp @@ -32,83 +32,85 @@ EndScriptData */ #define SPELL_BLASTWAVE 23331 #define SPELL_MORTALSTRIKE 24573 #define SPELL_KNOCKBACK 25778 - -struct boss_broodlordAI : public ScriptedAI +
class boss_broodlord : public CreatureScript { - boss_broodlordAI(Creature *c) : ScriptedAI(c) {} - - uint32 Cleave_Timer; - uint32 BlastWave_Timer; - uint32 MortalStrike_Timer; - uint32 KnockBack_Timer; - - void Reset() - { - Cleave_Timer = 8000; //These times are probably wrong - BlastWave_Timer = 12000; - MortalStrike_Timer = 20000; - KnockBack_Timer = 30000; - } +public: + boss_broodlord() : CreatureScript("boss_broodlord") { } - void EnterCombat(Unit * /*who*/) + CreatureAI* GetAI(Creature* pCreature) const { - DoScriptText(SAY_AGGRO, me); - DoZoneInCombat(); + return new boss_broodlordAI (pCreature); } - void UpdateAI(const uint32 diff) + struct boss_broodlordAI : public ScriptedAI { - if (!UpdateVictim()) - return; + boss_broodlordAI(Creature *c) : ScriptedAI(c) {} - //Cleave_Timer - if (Cleave_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_CLEAVE); - Cleave_Timer = 7000; - } else Cleave_Timer -= diff; + uint32 Cleave_Timer; + uint32 BlastWave_Timer; + uint32 MortalStrike_Timer; + uint32 KnockBack_Timer; - // BlastWave - if (BlastWave_Timer <= diff) + void Reset() { - DoCast(me->getVictim(), SPELL_BLASTWAVE); - BlastWave_Timer = urand(8000,16000); - } else BlastWave_Timer -= diff; + Cleave_Timer = 8000; //These times are probably wrong + BlastWave_Timer = 12000; + MortalStrike_Timer = 20000; + KnockBack_Timer = 30000; + } - //MortalStrike_Timer - if (MortalStrike_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - DoCast(me->getVictim(), SPELL_MORTALSTRIKE); - MortalStrike_Timer = urand(25000,35000); - } else MortalStrike_Timer -= diff; + DoScriptText(SAY_AGGRO, me); + DoZoneInCombat(); + } - if (KnockBack_Timer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_KNOCKBACK); - //Drop 50% aggro - if (DoGetThreat(me->getVictim())) - DoModifyThreatPercent(me->getVictim(),-50); + if (!UpdateVictim()) + return; + + //Cleave_Timer + if (Cleave_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_CLEAVE); + Cleave_Timer = 7000; + } else Cleave_Timer -= diff; + + // BlastWave + if (BlastWave_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_BLASTWAVE); + BlastWave_Timer = urand(8000,16000); + } else BlastWave_Timer -= diff; + + //MortalStrike_Timer + if (MortalStrike_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_MORTALSTRIKE); + MortalStrike_Timer = urand(25000,35000); + } else MortalStrike_Timer -= diff; + + if (KnockBack_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_KNOCKBACK); + //Drop 50% aggro + if (DoGetThreat(me->getVictim())) + DoModifyThreatPercent(me->getVictim(),-50); + + KnockBack_Timer = urand(15000,30000); + } else KnockBack_Timer -= diff; + + if (EnterEvadeIfOutOfCombatArea(diff)) + DoScriptText(SAY_LEASH, me); + + DoMeleeAttackIfReady(); + } + }; - KnockBack_Timer = urand(15000,30000); - } else KnockBack_Timer -= diff; - - if (EnterEvadeIfOutOfCombatArea(diff)) - DoScriptText(SAY_LEASH, me); - - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_broodlord(Creature* pCreature) -{ - return new boss_broodlordAI (pCreature); -} void AddSC_boss_broodlord() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_broodlord"; - newscript->GetAI = &GetAI_boss_broodlord; - newscript->RegisterSelf(); + new boss_broodlord(); } - diff --git a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_chromaggus.cpp b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_chromaggus.cpp index bc0e451932f..8c61db1c49c 100644 --- a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_chromaggus.cpp +++ b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_chromaggus.cpp @@ -58,246 +58,248 @@ enum Spells SPELL_FRENZY = 28371, //The frenzy spell may be wrong SPELL_ENRAGE = 28747 }; - -struct boss_chromaggusAI : public ScriptedAI +
class boss_chromaggus : public CreatureScript { - boss_chromaggusAI(Creature *c) : ScriptedAI(c) +public: + boss_chromaggus() : CreatureScript("boss_chromaggus") { } + + CreatureAI* GetAI(Creature* pCreature) const { - //Select the 2 breaths that we are going to use until despawned - //5 possiblities for the first breath, 4 for the second, 20 total possiblites - //This way we don't end up casting 2 of the same breath - //TL TL would be stupid - switch (urand(0,19)) - { - //B1 - Incin - case 0: - Breath1_Spell = SPELL_INCINERATE; - Breath2_Spell = SPELL_TIMELAPSE; - break; - case 1: - Breath1_Spell = SPELL_INCINERATE; - Breath2_Spell = SPELL_CORROSIVEACID; - break; - case 2: - Breath1_Spell = SPELL_INCINERATE; - Breath2_Spell = SPELL_IGNITEFLESH; - break; - case 3: - Breath1_Spell = SPELL_INCINERATE; - Breath2_Spell = SPELL_FROSTBURN; - break; - - //B1 - TL - case 4: - Breath1_Spell = SPELL_TIMELAPSE; - Breath2_Spell = SPELL_INCINERATE; - break; - case 5: - Breath1_Spell = SPELL_TIMELAPSE; - Breath2_Spell = SPELL_CORROSIVEACID; - break; - case 6: - Breath1_Spell = SPELL_TIMELAPSE; - Breath2_Spell = SPELL_IGNITEFLESH; - break; - case 7: - Breath1_Spell = SPELL_TIMELAPSE; - Breath2_Spell = SPELL_FROSTBURN; - break; - - //B1 - Acid - case 8: - Breath1_Spell = SPELL_CORROSIVEACID; - Breath2_Spell = SPELL_INCINERATE; - break; - case 9: - Breath1_Spell = SPELL_CORROSIVEACID; - Breath2_Spell = SPELL_TIMELAPSE; - break; - case 10: - Breath1_Spell = SPELL_CORROSIVEACID; - Breath2_Spell = SPELL_IGNITEFLESH; - break; - case 11: - Breath1_Spell = SPELL_CORROSIVEACID; - Breath2_Spell = SPELL_FROSTBURN; - break; - - //B1 - Ignite - case 12: - Breath1_Spell = SPELL_IGNITEFLESH; - Breath2_Spell = SPELL_INCINERATE; - break; - case 13: - Breath1_Spell = SPELL_IGNITEFLESH; - Breath2_Spell = SPELL_CORROSIVEACID; - break; - case 14: - Breath1_Spell = SPELL_IGNITEFLESH; - Breath2_Spell = SPELL_TIMELAPSE; - break; - case 15: - Breath1_Spell = SPELL_IGNITEFLESH; - Breath2_Spell = SPELL_FROSTBURN; - break; - - //B1 - Frost - case 16: - Breath1_Spell = SPELL_FROSTBURN; - Breath2_Spell = SPELL_INCINERATE; - break; - case 17: - Breath1_Spell = SPELL_FROSTBURN; - Breath2_Spell = SPELL_TIMELAPSE; - break; - case 18: - Breath1_Spell = SPELL_FROSTBURN; - Breath2_Spell = SPELL_CORROSIVEACID; - break; - case 19: - Breath1_Spell = SPELL_FROSTBURN; - Breath2_Spell = SPELL_IGNITEFLESH; - break; - }; - - EnterEvadeMode(); + return new boss_chromaggusAI (pCreature); } - uint32 Breath1_Spell; - uint32 Breath2_Spell; - uint32 CurrentVurln_Spell; + struct boss_chromaggusAI : public ScriptedAI + { + boss_chromaggusAI(Creature *c) : ScriptedAI(c) + { + //Select the 2 breaths that we are going to use until despawned + //5 possiblities for the first breath, 4 for the second, 20 total possiblites + //This way we don't end up casting 2 of the same breath + //TL TL would be stupid + switch (urand(0,19)) + { + //B1 - Incin + case 0: + Breath1_Spell = SPELL_INCINERATE; + Breath2_Spell = SPELL_TIMELAPSE; + break; + case 1: + Breath1_Spell = SPELL_INCINERATE; + Breath2_Spell = SPELL_CORROSIVEACID; + break; + case 2: + Breath1_Spell = SPELL_INCINERATE; + Breath2_Spell = SPELL_IGNITEFLESH; + break; + case 3: + Breath1_Spell = SPELL_INCINERATE; + Breath2_Spell = SPELL_FROSTBURN; + break; + + //B1 - TL + case 4: + Breath1_Spell = SPELL_TIMELAPSE; + Breath2_Spell = SPELL_INCINERATE; + break; + case 5: + Breath1_Spell = SPELL_TIMELAPSE; + Breath2_Spell = SPELL_CORROSIVEACID; + break; + case 6: + Breath1_Spell = SPELL_TIMELAPSE; + Breath2_Spell = SPELL_IGNITEFLESH; + break; + case 7: + Breath1_Spell = SPELL_TIMELAPSE; + Breath2_Spell = SPELL_FROSTBURN; + break; + + //B1 - Acid + case 8: + Breath1_Spell = SPELL_CORROSIVEACID; + Breath2_Spell = SPELL_INCINERATE; + break; + case 9: + Breath1_Spell = SPELL_CORROSIVEACID; + Breath2_Spell = SPELL_TIMELAPSE; + break; + case 10: + Breath1_Spell = SPELL_CORROSIVEACID; + Breath2_Spell = SPELL_IGNITEFLESH; + break; + case 11: + Breath1_Spell = SPELL_CORROSIVEACID; + Breath2_Spell = SPELL_FROSTBURN; + break; + + //B1 - Ignite + case 12: + Breath1_Spell = SPELL_IGNITEFLESH; + Breath2_Spell = SPELL_INCINERATE; + break; + case 13: + Breath1_Spell = SPELL_IGNITEFLESH; + Breath2_Spell = SPELL_CORROSIVEACID; + break; + case 14: + Breath1_Spell = SPELL_IGNITEFLESH; + Breath2_Spell = SPELL_TIMELAPSE; + break; + case 15: + Breath1_Spell = SPELL_IGNITEFLESH; + Breath2_Spell = SPELL_FROSTBURN; + break; + + //B1 - Frost + case 16: + Breath1_Spell = SPELL_FROSTBURN; + Breath2_Spell = SPELL_INCINERATE; + break; + case 17: + Breath1_Spell = SPELL_FROSTBURN; + Breath2_Spell = SPELL_TIMELAPSE; + break; + case 18: + Breath1_Spell = SPELL_FROSTBURN; + Breath2_Spell = SPELL_CORROSIVEACID; + break; + case 19: + Breath1_Spell = SPELL_FROSTBURN; + Breath2_Spell = SPELL_IGNITEFLESH; + break; + }; + + EnterEvadeMode(); + } - uint32 Shimmer_Timer; - uint32 Breath1_Timer; - uint32 Breath2_Timer; - uint32 Affliction_Timer; - uint32 Frenzy_Timer; - bool Enraged; + uint32 Breath1_Spell; + uint32 Breath2_Spell; + uint32 CurrentVurln_Spell; - void Reset() - { - CurrentVurln_Spell = 0; //We use this to store our last vulnerabilty spell so we can remove it later + uint32 Shimmer_Timer; + uint32 Breath1_Timer; + uint32 Breath2_Timer; + uint32 Affliction_Timer; + uint32 Frenzy_Timer; + bool Enraged; - Shimmer_Timer = 0; //Time till we change vurlnerabilites - Breath1_Timer = 30000; //First breath is 30 seconds - Breath2_Timer = 60000; //Second is 1 minute so that we can alternate - Affliction_Timer = 10000; //This is special - 5 seconds means that we cast this on 1 player every 5 sconds - Frenzy_Timer = 15000; + void Reset() + { + CurrentVurln_Spell = 0; //We use this to store our last vulnerabilty spell so we can remove it later - Enraged = false; - } + Shimmer_Timer = 0; //Time till we change vurlnerabilites + Breath1_Timer = 30000; //First breath is 30 seconds + Breath2_Timer = 60000; //Second is 1 minute so that we can alternate + Affliction_Timer = 10000; //This is special - 5 seconds means that we cast this on 1 player every 5 sconds + Frenzy_Timer = 15000; - void EnterCombat(Unit * /*who*/) - { - } + Enraged = false; + } - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + void EnterCombat(Unit * /*who*/) + { + } - //Shimmer_Timer Timer - if (Shimmer_Timer <= diff) + void UpdateAI(const uint32 diff) { - //Remove old vulnerabilty spell - if (CurrentVurln_Spell) - me->RemoveAurasDueToSpell(CurrentVurln_Spell); + if (!UpdateVictim()) + return; - //Cast new random vulnerabilty on self - uint32 spell = RAND(SPELL_FIRE_VULNERABILITY, SPELL_FROST_VULNERABILITY, - SPELL_SHADOW_VULNERABILITY, SPELL_NATURE_VULNERABILITY, SPELL_ARCANE_VULNERABILITY); + //Shimmer_Timer Timer + if (Shimmer_Timer <= diff) + { + //Remove old vulnerabilty spell + if (CurrentVurln_Spell) + me->RemoveAurasDueToSpell(CurrentVurln_Spell); - DoCast(me, spell); - CurrentVurln_Spell = spell; + //Cast new random vulnerabilty on self + uint32 spell = RAND(SPELL_FIRE_VULNERABILITY, SPELL_FROST_VULNERABILITY, + SPELL_SHADOW_VULNERABILITY, SPELL_NATURE_VULNERABILITY, SPELL_ARCANE_VULNERABILITY); - DoScriptText(EMOTE_SHIMMER, me); - Shimmer_Timer = 45000; - } else Shimmer_Timer -= diff; + DoCast(me, spell); + CurrentVurln_Spell = spell; - //Breath1_Timer - if (Breath1_Timer <= diff) - { - DoCast(me->getVictim(), Breath1_Spell); - Breath1_Timer = 60000; - } else Breath1_Timer -= diff; + DoScriptText(EMOTE_SHIMMER, me); + Shimmer_Timer = 45000; + } else Shimmer_Timer -= diff; - //Breath2_Timer - if (Breath2_Timer <= diff) - { - DoCast(me->getVictim(), Breath2_Spell); - Breath2_Timer = 60000; - } else Breath2_Timer -= diff; + //Breath1_Timer + if (Breath1_Timer <= diff) + { + DoCast(me->getVictim(), Breath1_Spell); + Breath1_Timer = 60000; + } else Breath1_Timer -= diff; - //Affliction_Timer - if (Affliction_Timer <= diff) - { - std::list<HostileReference*> threatlist = me->getThreatManager().getThreatList(); - for (std::list<HostileReference*>::const_iterator i = threatlist.begin(); i != threatlist.end(); ++i) + //Breath2_Timer + if (Breath2_Timer <= diff) + { + DoCast(me->getVictim(), Breath2_Spell); + Breath2_Timer = 60000; + } else Breath2_Timer -= diff; + + //Affliction_Timer + if (Affliction_Timer <= diff) { - Unit* pUnit; - if ((*i) && (*i)->getSource()) + std::list<HostileReference*> threatlist = me->getThreatManager().getThreatList(); + for (std::list<HostileReference*>::const_iterator i = threatlist.begin(); i != threatlist.end(); ++i) { - pUnit = Unit::GetUnit((*me), (*i)->getUnitGuid()); - if (pUnit) + Unit* pUnit; + if ((*i) && (*i)->getSource()) { - //Cast affliction - DoCast(pUnit, RAND(SPELL_BROODAF_BLUE, SPELL_BROODAF_BLACK, - SPELL_BROODAF_RED, SPELL_BROODAF_BRONZE, SPELL_BROODAF_GREEN), true); - - //Chromatic mutation if target is effected by all afflictions - if (pUnit->HasAura(SPELL_BROODAF_BLUE) - && pUnit->HasAura(SPELL_BROODAF_BLACK) - && pUnit->HasAura(SPELL_BROODAF_RED) - && pUnit->HasAura(SPELL_BROODAF_BRONZE) - && pUnit->HasAura(SPELL_BROODAF_GREEN)) + pUnit = Unit::GetUnit((*me), (*i)->getUnitGuid()); + if (pUnit) { - //pTarget->RemoveAllAuras(); - //DoCast(pTarget, SPELL_CHROMATIC_MUT_1); - - //Chromatic mutation is causing issues - //Assuming it is caused by a lack of core support for Charm - //So instead we instant kill our target - - //WORKAROUND - if (pUnit->GetTypeId() == TYPEID_PLAYER) - pUnit->CastSpell(pUnit, 5, false); + //Cast affliction + DoCast(pUnit, RAND(SPELL_BROODAF_BLUE, SPELL_BROODAF_BLACK, + SPELL_BROODAF_RED, SPELL_BROODAF_BRONZE, SPELL_BROODAF_GREEN), true); + + //Chromatic mutation if target is effected by all afflictions + if (pUnit->HasAura(SPELL_BROODAF_BLUE) + && pUnit->HasAura(SPELL_BROODAF_BLACK) + && pUnit->HasAura(SPELL_BROODAF_RED) + && pUnit->HasAura(SPELL_BROODAF_BRONZE) + && pUnit->HasAura(SPELL_BROODAF_GREEN)) + { + //pTarget->RemoveAllAuras(); + //DoCast(pTarget, SPELL_CHROMATIC_MUT_1); + + //Chromatic mutation is causing issues + //Assuming it is caused by a lack of core support for Charm + //So instead we instant kill our target + + //WORKAROUND + if (pUnit->GetTypeId() == TYPEID_PLAYER) + pUnit->CastSpell(pUnit, 5, false); + } } } } - } - Affliction_Timer = 10000; - } else Affliction_Timer -= diff; + Affliction_Timer = 10000; + } else Affliction_Timer -= diff; - //Frenzy_Timer - if (Frenzy_Timer <= diff) - { - DoCast(me, SPELL_FRENZY); - DoScriptText(EMOTE_FRENZY, me); - Frenzy_Timer = urand(10000,15000); - } else Frenzy_Timer -= diff; + //Frenzy_Timer + if (Frenzy_Timer <= diff) + { + DoCast(me, SPELL_FRENZY); + DoScriptText(EMOTE_FRENZY, me); + Frenzy_Timer = urand(10000,15000); + } else Frenzy_Timer -= diff; - //Enrage if not already enraged and below 20% - if (!Enraged && (me->GetHealth()*100 / me->GetMaxHealth()) < 20) - { - DoCast(me, SPELL_ENRAGE); - Enraged = true; + //Enrage if not already enraged and below 20% + if (!Enraged && (me->GetHealth()*100 / me->GetMaxHealth()) < 20) + { + DoCast(me, SPELL_ENRAGE); + Enraged = true; + } + + DoMeleeAttackIfReady(); } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_chromaggus(Creature* pCreature) -{ - return new boss_chromaggusAI (pCreature); -} void AddSC_boss_chromaggus() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_chromaggus"; - newscript->GetAI = &GetAI_boss_chromaggus; - newscript->RegisterSelf(); + new boss_chromaggus(); } - diff --git a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_ebonroc.cpp b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_ebonroc.cpp index 1eeb7b3a6ae..22f425d7be4 100644 --- a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_ebonroc.cpp +++ b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_ebonroc.cpp @@ -29,78 +29,80 @@ EndScriptData */ #define SPELL_WINGBUFFET 18500 #define SPELL_SHADOWOFEBONROC 23340 #define SPELL_HEAL 41386 //Thea Heal spell of his Shadow - -struct boss_ebonrocAI : public ScriptedAI +
class boss_ebonroc : public CreatureScript { - boss_ebonrocAI(Creature *c) : ScriptedAI(c) {} - - uint32 ShadowFlame_Timer; - uint32 WingBuffet_Timer; - uint32 ShadowOfEbonroc_Timer; - uint32 Heal_Timer; +public: + boss_ebonroc() : CreatureScript("boss_ebonroc") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - ShadowFlame_Timer = 15000; //These times are probably wrong - WingBuffet_Timer = 30000; - ShadowOfEbonroc_Timer = 45000; - Heal_Timer = 1000; + return new boss_ebonrocAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_ebonrocAI : public ScriptedAI { - DoZoneInCombat(); - } + boss_ebonrocAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + uint32 ShadowFlame_Timer; + uint32 WingBuffet_Timer; + uint32 ShadowOfEbonroc_Timer; + uint32 Heal_Timer; - //Shadowflame Timer - if (ShadowFlame_Timer <= diff) + void Reset() { - DoCast(me->getVictim(), SPELL_SHADOWFLAME); - ShadowFlame_Timer = urand(12000,15000); - } else ShadowFlame_Timer -= diff; + ShadowFlame_Timer = 15000; //These times are probably wrong + WingBuffet_Timer = 30000; + ShadowOfEbonroc_Timer = 45000; + Heal_Timer = 1000; + } - //Wing Buffet Timer - if (WingBuffet_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - DoCast(me->getVictim(), SPELL_WINGBUFFET); - WingBuffet_Timer = 25000; - } else WingBuffet_Timer -= diff; + DoZoneInCombat(); + } - //Shadow of Ebonroc Timer - if (ShadowOfEbonroc_Timer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_SHADOWOFEBONROC); - ShadowOfEbonroc_Timer = urand(25000,350000); - } else ShadowOfEbonroc_Timer -= diff; + if (!UpdateVictim()) + return; - if (me->getVictim()->HasAura(SPELL_SHADOWOFEBONROC)) - { - if (Heal_Timer <= diff) + //Shadowflame Timer + if (ShadowFlame_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_SHADOWFLAME); + ShadowFlame_Timer = urand(12000,15000); + } else ShadowFlame_Timer -= diff; + + //Wing Buffet Timer + if (WingBuffet_Timer <= diff) { - DoCast(me, SPELL_HEAL); - Heal_Timer = urand(1000,3000); - } else Heal_Timer -= diff; + DoCast(me->getVictim(), SPELL_WINGBUFFET); + WingBuffet_Timer = 25000; + } else WingBuffet_Timer -= diff; + + //Shadow of Ebonroc Timer + if (ShadowOfEbonroc_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_SHADOWOFEBONROC); + ShadowOfEbonroc_Timer = urand(25000,350000); + } else ShadowOfEbonroc_Timer -= diff; + + if (me->getVictim()->HasAura(SPELL_SHADOWOFEBONROC)) + { + if (Heal_Timer <= diff) + { + DoCast(me, SPELL_HEAL); + Heal_Timer = urand(1000,3000); + } else Heal_Timer -= diff; + } + + DoMeleeAttackIfReady(); } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_ebonroc(Creature* pCreature) -{ - return new boss_ebonrocAI (pCreature); -} void AddSC_boss_ebonroc() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_ebonroc"; - newscript->GetAI = &GetAI_boss_ebonroc; - newscript->RegisterSelf(); + new boss_ebonroc(); } - diff --git a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_firemaw.cpp b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_firemaw.cpp index a9142a2049b..79952f76bf4 100644 --- a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_firemaw.cpp +++ b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_firemaw.cpp @@ -28,70 +28,72 @@ EndScriptData */ #define SPELL_SHADOWFLAME 22539 #define SPELL_WINGBUFFET 23339 #define SPELL_FLAMEBUFFET 23341 - -struct boss_firemawAI : public ScriptedAI +
class boss_firemaw : public CreatureScript { - boss_firemawAI(Creature *c) : ScriptedAI(c) {} - - uint32 ShadowFlame_Timer; - uint32 WingBuffet_Timer; - uint32 FlameBuffet_Timer; +public: + boss_firemaw() : CreatureScript("boss_firemaw") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - ShadowFlame_Timer = 30000; //These times are probably wrong - WingBuffet_Timer = 24000; - FlameBuffet_Timer = 5000; + return new boss_firemawAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_firemawAI : public ScriptedAI { - DoZoneInCombat(); - } + boss_firemawAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + uint32 ShadowFlame_Timer; + uint32 WingBuffet_Timer; + uint32 FlameBuffet_Timer; - //ShadowFlame_Timer - if (ShadowFlame_Timer <= diff) + void Reset() { - DoCast(me->getVictim(), SPELL_SHADOWFLAME); - ShadowFlame_Timer = urand(15000,18000); - } else ShadowFlame_Timer -= diff; + ShadowFlame_Timer = 30000; //These times are probably wrong + WingBuffet_Timer = 24000; + FlameBuffet_Timer = 5000; + } - //WingBuffet_Timer - if (WingBuffet_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - DoCast(me->getVictim(), SPELL_WINGBUFFET); - if (DoGetThreat(me->getVictim())) - DoModifyThreatPercent(me->getVictim(),-75); - - WingBuffet_Timer = 25000; - } else WingBuffet_Timer -= diff; + DoZoneInCombat(); + } - //FlameBuffet_Timer - if (FlameBuffet_Timer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_FLAMEBUFFET); - FlameBuffet_Timer = 5000; - } else FlameBuffet_Timer -= diff; + if (!UpdateVictim()) + return; + + //ShadowFlame_Timer + if (ShadowFlame_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_SHADOWFLAME); + ShadowFlame_Timer = urand(15000,18000); + } else ShadowFlame_Timer -= diff; + + //WingBuffet_Timer + if (WingBuffet_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_WINGBUFFET); + if (DoGetThreat(me->getVictim())) + DoModifyThreatPercent(me->getVictim(),-75); + + WingBuffet_Timer = 25000; + } else WingBuffet_Timer -= diff; + + //FlameBuffet_Timer + if (FlameBuffet_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_FLAMEBUFFET); + FlameBuffet_Timer = 5000; + } else FlameBuffet_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_firemaw(Creature* pCreature) -{ - return new boss_firemawAI (pCreature); -} void AddSC_boss_firemaw() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_firemaw"; - newscript->GetAI = &GetAI_boss_firemaw; - newscript->RegisterSelf(); + new boss_firemaw(); } - diff --git a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_flamegor.cpp b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_flamegor.cpp index 32fc2d52b37..4653e87e4de 100644 --- a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_flamegor.cpp +++ b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_flamegor.cpp @@ -30,71 +30,73 @@ EndScriptData */ #define SPELL_SHADOWFLAME 22539 #define SPELL_WINGBUFFET 23339 #define SPELL_FRENZY 23342 //This spell periodically triggers fire nova - -struct boss_flamegorAI : public ScriptedAI +
class boss_flamegor : public CreatureScript { - boss_flamegorAI(Creature *c) : ScriptedAI(c) {} - - uint32 ShadowFlame_Timer; - uint32 WingBuffet_Timer; - uint32 Frenzy_Timer; +public: + boss_flamegor() : CreatureScript("boss_flamegor") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - ShadowFlame_Timer = 21000; //These times are probably wrong - WingBuffet_Timer = 35000; - Frenzy_Timer = 10000; + return new boss_flamegorAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_flamegorAI : public ScriptedAI { - DoZoneInCombat(); - } + boss_flamegorAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + uint32 ShadowFlame_Timer; + uint32 WingBuffet_Timer; + uint32 Frenzy_Timer; - //ShadowFlame_Timer - if (ShadowFlame_Timer <= diff) + void Reset() { - DoCast(me->getVictim(), SPELL_SHADOWFLAME); - ShadowFlame_Timer = 15000 + rand()%7000; - } else ShadowFlame_Timer -= diff; + ShadowFlame_Timer = 21000; //These times are probably wrong + WingBuffet_Timer = 35000; + Frenzy_Timer = 10000; + } - //WingBuffet_Timer - if (WingBuffet_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - DoCast(me->getVictim(), SPELL_WINGBUFFET); - if (DoGetThreat(me->getVictim())) - DoModifyThreatPercent(me->getVictim(),-75); - - WingBuffet_Timer = 25000; - } else WingBuffet_Timer -= diff; + DoZoneInCombat(); + } - //Frenzy_Timer - if (Frenzy_Timer <= diff) + void UpdateAI(const uint32 diff) { - DoScriptText(EMOTE_FRENZY, me); - DoCast(me, SPELL_FRENZY); - Frenzy_Timer = urand(8000, 10000); - } else Frenzy_Timer -= diff; + if (!UpdateVictim()) + return; + + //ShadowFlame_Timer + if (ShadowFlame_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_SHADOWFLAME); + ShadowFlame_Timer = 15000 + rand()%7000; + } else ShadowFlame_Timer -= diff; + + //WingBuffet_Timer + if (WingBuffet_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_WINGBUFFET); + if (DoGetThreat(me->getVictim())) + DoModifyThreatPercent(me->getVictim(),-75); + + WingBuffet_Timer = 25000; + } else WingBuffet_Timer -= diff; + + //Frenzy_Timer + if (Frenzy_Timer <= diff) + { + DoScriptText(EMOTE_FRENZY, me); + DoCast(me, SPELL_FRENZY); + Frenzy_Timer = urand(8000, 10000); + } else Frenzy_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_flamegor(Creature* pCreature) -{ - return new boss_flamegorAI (pCreature); -} void AddSC_boss_flamegor() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_flamegor"; - newscript->GetAI = &GetAI_boss_flamegor; - newscript->RegisterSelf(); + new boss_flamegor(); } - diff --git a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_nefarian.cpp b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_nefarian.cpp index b78c999e0e5..4618b98c55e 100644 --- a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_nefarian.cpp +++ b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_nefarian.cpp @@ -59,175 +59,177 @@ EndScriptData */ #define SPELL_WARLOCK 23427 //infernals #define SPELL_HUNTER 23436 //bow broke #define SPELL_ROGUE 23414 //Paralise - -struct boss_nefarianAI : public ScriptedAI +
class boss_nefarian : public CreatureScript { - boss_nefarianAI(Creature *c) : ScriptedAI(c) {} - - uint32 ShadowFlame_Timer; - uint32 BellowingRoar_Timer; - uint32 VeilOfShadow_Timer; - uint32 Cleave_Timer; - uint32 TailLash_Timer; - uint32 ClassCall_Timer; - bool Phase3; - - uint32 DespawnTimer; +public: + boss_nefarian() : CreatureScript("boss_nefarian") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - ShadowFlame_Timer = 12000; //These times are probably wrong - BellowingRoar_Timer = 30000; - VeilOfShadow_Timer = 15000; - Cleave_Timer = 7000; - TailLash_Timer = 10000; - ClassCall_Timer = 35000; //35-40 seconds - Phase3 = false; - - DespawnTimer = 5000; + return new boss_nefarianAI (pCreature); } - void KilledUnit(Unit* Victim) + struct boss_nefarianAI : public ScriptedAI { - if (rand()%5) - return; + boss_nefarianAI(Creature *c) : ScriptedAI(c) {} - DoScriptText(SAY_SLAY, me, Victim); - } + uint32 ShadowFlame_Timer; + uint32 BellowingRoar_Timer; + uint32 VeilOfShadow_Timer; + uint32 Cleave_Timer; + uint32 TailLash_Timer; + uint32 ClassCall_Timer; + bool Phase3; - void JustDied(Unit* /*Killer*/) - { - DoScriptText(SAY_DEATH, me); - } + uint32 DespawnTimer; - void EnterCombat(Unit * who) - { - DoScriptText(RAND(SAY_XHEALTH,SAY_AGGRO,SAY_SHADOWFLAME), me); + void Reset() + { + ShadowFlame_Timer = 12000; //These times are probably wrong + BellowingRoar_Timer = 30000; + VeilOfShadow_Timer = 15000; + Cleave_Timer = 7000; + TailLash_Timer = 10000; + ClassCall_Timer = 35000; //35-40 seconds + Phase3 = false; - DoCast(who, SPELL_SHADOWFLAME_INITIAL); - DoZoneInCombat(); - } + DespawnTimer = 5000; + } - void UpdateAI(const uint32 diff) - { - if (DespawnTimer <= diff) + void KilledUnit(Unit* Victim) { - if (!UpdateVictim()) - me->ForcedDespawn(); - DespawnTimer = 5000; - } else DespawnTimer -= diff; + if (rand()%5) + return; - if (!UpdateVictim()) - return; + DoScriptText(SAY_SLAY, me, Victim); + } - //ShadowFlame_Timer - if (ShadowFlame_Timer <= diff) + void JustDied(Unit* /*Killer*/) { - DoCast(me->getVictim(), SPELL_SHADOWFLAME); - ShadowFlame_Timer = 12000; - } else ShadowFlame_Timer -= diff; + DoScriptText(SAY_DEATH, me); + } - //BellowingRoar_Timer - if (BellowingRoar_Timer <= diff) + void EnterCombat(Unit * who) { - DoCast(me->getVictim(), SPELL_BELLOWINGROAR); - BellowingRoar_Timer = 30000; - } else BellowingRoar_Timer -= diff; + DoScriptText(RAND(SAY_XHEALTH,SAY_AGGRO,SAY_SHADOWFLAME), me); - //VeilOfShadow_Timer - if (VeilOfShadow_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_VEILOFSHADOW); - VeilOfShadow_Timer = 15000; - } else VeilOfShadow_Timer -= diff; + DoCast(who, SPELL_SHADOWFLAME_INITIAL); + DoZoneInCombat(); + } - //Cleave_Timer - if (Cleave_Timer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_CLEAVE); - Cleave_Timer = 7000; - } else Cleave_Timer -= diff; + if (DespawnTimer <= diff) + { + if (!UpdateVictim()) + me->ForcedDespawn(); + DespawnTimer = 5000; + } else DespawnTimer -= diff; - //TailLash_Timer - if (TailLash_Timer <= diff) - { - //Cast NYI since we need a better check for behind target - //DoCast(me->getVictim(), SPELL_TAILLASH); + if (!UpdateVictim()) + return; - TailLash_Timer = 10000; - } else TailLash_Timer -= diff; + //ShadowFlame_Timer + if (ShadowFlame_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_SHADOWFLAME); + ShadowFlame_Timer = 12000; + } else ShadowFlame_Timer -= diff; - //ClassCall_Timer - if (ClassCall_Timer <= diff) - { - //Cast a random class call - //On official it is based on what classes are currently on the hostil list - //but we can't do that yet so just randomly call one + //BellowingRoar_Timer + if (BellowingRoar_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_BELLOWINGROAR); + BellowingRoar_Timer = 30000; + } else BellowingRoar_Timer -= diff; - switch (urand(0,8)) + //VeilOfShadow_Timer + if (VeilOfShadow_Timer <= diff) { - case 0: - DoScriptText(SAY_MAGE, me); - DoCast(me, SPELL_MAGE); - break; - case 1: - DoScriptText(SAY_WARRIOR, me); - DoCast(me, SPELL_WARRIOR); - break; - case 2: - DoScriptText(SAY_DRUID, me); - DoCast(me, SPELL_DRUID); - break; - case 3: - DoScriptText(SAY_PRIEST, me); - DoCast(me, SPELL_PRIEST); - break; - case 4: - DoScriptText(SAY_PALADIN, me); - DoCast(me, SPELL_PALADIN); - break; - case 5: - DoScriptText(SAY_SHAMAN, me); - DoCast(me, SPELL_SHAMAN); - break; - case 6: - DoScriptText(SAY_WARLOCK, me); - DoCast(me, SPELL_WARLOCK); - break; - case 7: - DoScriptText(SAY_HUNTER, me); - DoCast(me, SPELL_HUNTER); - break; - case 8: - DoScriptText(SAY_ROGUE, me); - DoCast(me, SPELL_ROGUE); - break; - } + DoCast(me->getVictim(), SPELL_VEILOFSHADOW); + VeilOfShadow_Timer = 15000; + } else VeilOfShadow_Timer -= diff; - ClassCall_Timer = 35000 + (rand() % 5000); - } else ClassCall_Timer -= diff; + //Cleave_Timer + if (Cleave_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_CLEAVE); + Cleave_Timer = 7000; + } else Cleave_Timer -= diff; - //Phase3 begins when we are below X health - if (!Phase3 && (me->GetHealth()*100 / me->GetMaxHealth()) < 20) - { - Phase3 = true; - DoScriptText(SAY_RAISE_SKELETONS, me); + //TailLash_Timer + if (TailLash_Timer <= diff) + { + //Cast NYI since we need a better check for behind target + //DoCast(me->getVictim(), SPELL_TAILLASH); + + TailLash_Timer = 10000; + } else TailLash_Timer -= diff; + + //ClassCall_Timer + if (ClassCall_Timer <= diff) + { + //Cast a random class call + //On official it is based on what classes are currently on the hostil list + //but we can't do that yet so just randomly call one + + switch (urand(0,8)) + { + case 0: + DoScriptText(SAY_MAGE, me); + DoCast(me, SPELL_MAGE); + break; + case 1: + DoScriptText(SAY_WARRIOR, me); + DoCast(me, SPELL_WARRIOR); + break; + case 2: + DoScriptText(SAY_DRUID, me); + DoCast(me, SPELL_DRUID); + break; + case 3: + DoScriptText(SAY_PRIEST, me); + DoCast(me, SPELL_PRIEST); + break; + case 4: + DoScriptText(SAY_PALADIN, me); + DoCast(me, SPELL_PALADIN); + break; + case 5: + DoScriptText(SAY_SHAMAN, me); + DoCast(me, SPELL_SHAMAN); + break; + case 6: + DoScriptText(SAY_WARLOCK, me); + DoCast(me, SPELL_WARLOCK); + break; + case 7: + DoScriptText(SAY_HUNTER, me); + DoCast(me, SPELL_HUNTER); + break; + case 8: + DoScriptText(SAY_ROGUE, me); + DoCast(me, SPELL_ROGUE); + break; + } + + ClassCall_Timer = 35000 + (rand() % 5000); + } else ClassCall_Timer -= diff; + + //Phase3 begins when we are below X health + if (!Phase3 && (me->GetHealth()*100 / me->GetMaxHealth()) < 20) + { + Phase3 = true; + DoScriptText(SAY_RAISE_SKELETONS, me); + } + + DoMeleeAttackIfReady(); } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_nefarian(Creature* pCreature) -{ - return new boss_nefarianAI (pCreature); -} void AddSC_boss_nefarian() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_nefarian"; - newscript->GetAI = &GetAI_boss_nefarian; - newscript->RegisterSelf(); + new boss_nefarian(); } - diff --git a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_razorgore.cpp b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_razorgore.cpp index 59c4d2a6730..4a7d25ccb75 100644 --- a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_razorgore.cpp +++ b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_razorgore.cpp @@ -36,92 +36,94 @@ EndScriptData */ #define SPELL_WARSTOMP 24375 #define SPELL_FIREBALLVOLLEY 22425 #define SPELL_CONFLAGRATION 23023 - -struct boss_razorgoreAI : public ScriptedAI +
class boss_razorgore : public CreatureScript { - boss_razorgoreAI(Creature *c) : ScriptedAI(c) {} - - uint32 Cleave_Timer; - uint32 WarStomp_Timer; - uint32 FireballVolley_Timer; - uint32 Conflagration_Timer; - - void Reset() - { - Cleave_Timer = 15000; //These times are probably wrong - WarStomp_Timer = 35000; - FireballVolley_Timer = 7000; - Conflagration_Timer = 12000; - } +public: + boss_razorgore() : CreatureScript("boss_razorgore") { } - void EnterCombat(Unit * /*who*/) + CreatureAI* GetAI(Creature* pCreature) const { - DoZoneInCombat(); + return new boss_razorgoreAI (pCreature); } - void JustDied(Unit* /*Killer*/) + struct boss_razorgoreAI : public ScriptedAI { - DoScriptText(SAY_DEATH, me); - } + boss_razorgoreAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + uint32 Cleave_Timer; + uint32 WarStomp_Timer; + uint32 FireballVolley_Timer; + uint32 Conflagration_Timer; - //Cleave_Timer - if (Cleave_Timer <= diff) + void Reset() { - DoCast(me->getVictim(), SPELL_CLEAVE); - Cleave_Timer = urand(7000,10000); - } else Cleave_Timer -= diff; + Cleave_Timer = 15000; //These times are probably wrong + WarStomp_Timer = 35000; + FireballVolley_Timer = 7000; + Conflagration_Timer = 12000; + } - //WarStomp_Timer - if (WarStomp_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - DoCast(me->getVictim(), SPELL_WARSTOMP); - WarStomp_Timer = urand(15000,25000); - } else WarStomp_Timer -= diff; + DoZoneInCombat(); + } - //FireballVolley_Timer - if (FireballVolley_Timer <= diff) + void JustDied(Unit* /*Killer*/) { - DoCast(me->getVictim(), SPELL_FIREBALLVOLLEY); - FireballVolley_Timer = urand(12000,15000); - } else FireballVolley_Timer -= diff; + DoScriptText(SAY_DEATH, me); + } - //Conflagration_Timer - if (Conflagration_Timer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_CONFLAGRATION); - //We will remove this threat reduction and add an aura check. + if (!UpdateVictim()) + return; + + //Cleave_Timer + if (Cleave_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_CLEAVE); + Cleave_Timer = urand(7000,10000); + } else Cleave_Timer -= diff; + + //WarStomp_Timer + if (WarStomp_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_WARSTOMP); + WarStomp_Timer = urand(15000,25000); + } else WarStomp_Timer -= diff; + + //FireballVolley_Timer + if (FireballVolley_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_FIREBALLVOLLEY); + FireballVolley_Timer = urand(12000,15000); + } else FireballVolley_Timer -= diff; + + //Conflagration_Timer + if (Conflagration_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_CONFLAGRATION); + //We will remove this threat reduction and add an aura check. + + //if (DoGetThreat(me->getVictim())) + //DoModifyThreatPercent(me->getVictim(),-50); + + Conflagration_Timer = 12000; + } else Conflagration_Timer -= diff; + + // Aura Check. If the gamer is affected by confliguration we attack a random gamer. + if (me->getVictim() && me->getVictim()->HasAura(SPELL_CONFLAGRATION)) + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true)) + me->TauntApply(pTarget); + + DoMeleeAttackIfReady(); + } + }; - //if (DoGetThreat(me->getVictim())) - //DoModifyThreatPercent(me->getVictim(),-50); - - Conflagration_Timer = 12000; - } else Conflagration_Timer -= diff; - - // Aura Check. If the gamer is affected by confliguration we attack a random gamer. - if (me->getVictim() && me->getVictim()->HasAura(SPELL_CONFLAGRATION)) - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true)) - me->TauntApply(pTarget); - - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_razorgore(Creature* pCreature) -{ - return new boss_razorgoreAI (pCreature); -} void AddSC_boss_razorgore() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_razorgore"; - newscript->GetAI = &GetAI_boss_razorgore; - newscript->RegisterSelf(); + new boss_razorgore(); } - diff --git a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_vaelastrasz.cpp b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_vaelastrasz.cpp index bba4cac82f1..3f2c1643b72 100644 --- a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_vaelastrasz.cpp +++ b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_vaelastrasz.cpp @@ -39,226 +39,225 @@ EndScriptData */ #define SPELL_TAILSWIPE 15847 #define SPELL_BURNINGADRENALINE 23620 #define SPELL_CLEAVE 20684 //Chain cleave is most likely named something different and contains a dummy effect - -struct boss_vaelAI : public ScriptedAI +
class boss_vaelastrasz : public CreatureScript { - boss_vaelAI(Creature *c) : ScriptedAI(c) - { - c->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - c->setFaction(35); - c->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - } +public: + boss_vaelastrasz() : CreatureScript("boss_vaelastrasz") { } - uint64 PlayerGUID; - uint32 SpeechTimer; - uint32 SpeechNum; - uint32 Cleave_Timer; - uint32 FlameBreath_Timer; - uint32 FireNova_Timer; - uint32 BurningAdrenalineCaster_Timer; - uint32 BurningAdrenalineTank_Timer; - uint32 TailSwipe_Timer; - bool HasYelled; - bool DoingSpeech; - - void Reset() + void SendDefaultMenu(Player* pPlayer, Creature* pCreature, uint32 uiAction) { - PlayerGUID = 0; - SpeechTimer = 0; - SpeechNum = 0; - Cleave_Timer = 8000; //These times are probably wrong - FlameBreath_Timer = 11000; - BurningAdrenalineCaster_Timer = 15000; - BurningAdrenalineTank_Timer = 45000; - FireNova_Timer = 5000; - TailSwipe_Timer = 20000; - HasYelled = false; - DoingSpeech = false; + if (uiAction == GOSSIP_ACTION_INFO_DEF + 1) //Fight time + { + pPlayer->CLOSE_GOSSIP_MENU(); + CAST_AI(boss_vaelastrasz::boss_vaelAI, pCreature->AI())->BeginSpeech(pPlayer); + } } - void BeginSpeech(Unit *pTarget) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { - //Stand up and begin speach - PlayerGUID = pTarget->GetGUID(); - - //10 seconds - DoScriptText(SAY_LINE1, me); + if (uiSender == GOSSIP_SENDER_MAIN) + SendDefaultMenu(pPlayer, pCreature, uiAction); - SpeechTimer = 10000; - SpeechNum = 0; - DoingSpeech = true; - - me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + return true; } - void KilledUnit(Unit * victim) + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - if (rand()%5) - return; + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + pPlayer->SEND_GOSSIP_MENU(907, pCreature->GetGUID()); - DoScriptText(SAY_KILLTARGET, me, victim); + return true; } - void EnterCombat(Unit * /*who*/) + CreatureAI* GetAI(Creature* pCreature) const { - DoCast(me, SPELL_ESSENCEOFTHERED); - DoZoneInCombat(); - me->SetHealth(int(me->GetMaxHealth()*.3)); + return new boss_vaelAI (pCreature); } - void UpdateAI(const uint32 diff) + struct boss_vaelAI : public ScriptedAI { - //Speech - if (DoingSpeech) + boss_vaelAI(Creature *c) : ScriptedAI(c) { - if (SpeechTimer <= diff) - { - switch (SpeechNum) - { - case 0: - //16 seconds till next line - DoScriptText(SAY_LINE2, me); - SpeechTimer = 16000; - ++SpeechNum; - break; - case 1: - //This one is actually 16 seconds but we only go to 10 seconds because he starts attacking after he says "I must fight this!" - DoScriptText(SAY_LINE3, me); - SpeechTimer = 10000; - ++SpeechNum; - break; - case 2: - me->setFaction(103); - if (PlayerGUID && Unit::GetUnit((*me),PlayerGUID)) - { - AttackStart(Unit::GetUnit((*me),PlayerGUID)); - DoCast(me, SPELL_ESSENCEOFTHERED); - } - SpeechTimer = 0; - DoingSpeech = false; - break; - } - } else SpeechTimer -= diff; + c->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + c->setFaction(35); + c->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); } - //Return since we have no target - if (!UpdateVictim()) - return; - - // Yell if hp lower than 15% - if (me->GetHealth()*100 / me->GetMaxHealth() < 15 && !HasYelled) + uint64 PlayerGUID; + uint32 SpeechTimer; + uint32 SpeechNum; + uint32 Cleave_Timer; + uint32 FlameBreath_Timer; + uint32 FireNova_Timer; + uint32 BurningAdrenalineCaster_Timer; + uint32 BurningAdrenalineTank_Timer; + uint32 TailSwipe_Timer; + bool HasYelled; + bool DoingSpeech; + + void Reset() { - DoScriptText(SAY_HALFLIFE, me); - HasYelled = true; + PlayerGUID = 0; + SpeechTimer = 0; + SpeechNum = 0; + Cleave_Timer = 8000; //These times are probably wrong + FlameBreath_Timer = 11000; + BurningAdrenalineCaster_Timer = 15000; + BurningAdrenalineTank_Timer = 45000; + FireNova_Timer = 5000; + TailSwipe_Timer = 20000; + HasYelled = false; + DoingSpeech = false; } - //Cleave_Timer - if (Cleave_Timer <= diff) + void BeginSpeech(Unit *pTarget) { - DoCast(me->getVictim(), SPELL_CLEAVE); - Cleave_Timer = 15000; - } else Cleave_Timer -= diff; + //Stand up and begin speach + PlayerGUID = pTarget->GetGUID(); + + //10 seconds + DoScriptText(SAY_LINE1, me); - //FlameBreath_Timer - if (FlameBreath_Timer <= diff) + SpeechTimer = 10000; + SpeechNum = 0; + DoingSpeech = true; + + me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + } + + void KilledUnit(Unit * victim) { - DoCast(me->getVictim(), SPELL_FLAMEBREATH); - FlameBreath_Timer = urand(4000,8000); - } else FlameBreath_Timer -= diff; + if (rand()%5) + return; + + DoScriptText(SAY_KILLTARGET, me, victim); + } - //BurningAdrenalineCaster_Timer - if (BurningAdrenalineCaster_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - Unit *pTarget = NULL; + DoCast(me, SPELL_ESSENCEOFTHERED); + DoZoneInCombat(); + me->SetHealth(int(me->GetMaxHealth()*.3)); + } - uint8 i = 0; - while (i < 3) // max 3 tries to get a random target with power_mana + void UpdateAI(const uint32 diff) + { + //Speech + if (DoingSpeech) { - ++i; - pTarget = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true); //not aggro leader - if (pTarget && pTarget->getPowerType() == POWER_MANA) - i = 3; + if (SpeechTimer <= diff) + { + switch (SpeechNum) + { + case 0: + //16 seconds till next line + DoScriptText(SAY_LINE2, me); + SpeechTimer = 16000; + ++SpeechNum; + break; + case 1: + //This one is actually 16 seconds but we only go to 10 seconds because he starts attacking after he says "I must fight this!" + DoScriptText(SAY_LINE3, me); + SpeechTimer = 10000; + ++SpeechNum; + break; + case 2: + me->setFaction(103); + if (PlayerGUID && Unit::GetUnit((*me),PlayerGUID)) + { + AttackStart(Unit::GetUnit((*me),PlayerGUID)); + DoCast(me, SPELL_ESSENCEOFTHERED); + } + SpeechTimer = 0; + DoingSpeech = false; + break; + } + } else SpeechTimer -= diff; } - if (pTarget) // cast on self (see below) - pTarget->CastSpell(pTarget,SPELL_BURNINGADRENALINE,1); - BurningAdrenalineCaster_Timer = 15000; - } else BurningAdrenalineCaster_Timer -= diff; + //Return since we have no target + if (!UpdateVictim()) + return; - //BurningAdrenalineTank_Timer - if (BurningAdrenalineTank_Timer <= diff) - { - // have the victim cast the spell on himself otherwise the third effect aura will be applied - // to Vael instead of the player - me->getVictim()->CastSpell(me->getVictim(),SPELL_BURNINGADRENALINE,1); + // Yell if hp lower than 15% + if (me->GetHealth()*100 / me->GetMaxHealth() < 15 && !HasYelled) + { + DoScriptText(SAY_HALFLIFE, me); + HasYelled = true; + } - BurningAdrenalineTank_Timer = 45000; - } else BurningAdrenalineTank_Timer -= diff; + //Cleave_Timer + if (Cleave_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_CLEAVE); + Cleave_Timer = 15000; + } else Cleave_Timer -= diff; - //FireNova_Timer - if (FireNova_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_FIRENOVA); - FireNova_Timer = 5000; - } else FireNova_Timer -= diff; + //FlameBreath_Timer + if (FlameBreath_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_FLAMEBREATH); + FlameBreath_Timer = urand(4000,8000); + } else FlameBreath_Timer -= diff; - //TailSwipe_Timer - if (TailSwipe_Timer <= diff) - { - //Only cast if we are behind - /*if (!me->HasInArc(M_PI, me->getVictim())) + //BurningAdrenalineCaster_Timer + if (BurningAdrenalineCaster_Timer <= diff) { - DoCast(me->getVictim(), SPELL_TAILSWIPE); - }*/ + Unit *pTarget = NULL; - TailSwipe_Timer = 20000; - } else TailSwipe_Timer -= diff; + uint8 i = 0; + while (i < 3) // max 3 tries to get a random target with power_mana + { + ++i; + pTarget = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true); //not aggro leader + if (pTarget && pTarget->getPowerType() == POWER_MANA) + i = 3; + } + if (pTarget) // cast on self (see below) + pTarget->CastSpell(pTarget,SPELL_BURNINGADRENALINE,1); - DoMeleeAttackIfReady(); - } -}; + BurningAdrenalineCaster_Timer = 15000; + } else BurningAdrenalineCaster_Timer -= diff; -void SendDefaultMenu_boss_vael(Player* pPlayer, Creature* pCreature, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF + 1) //Fight time - { - pPlayer->CLOSE_GOSSIP_MENU(); - CAST_AI(boss_vaelAI, pCreature->AI())->BeginSpeech(pPlayer); - } -} + //BurningAdrenalineTank_Timer + if (BurningAdrenalineTank_Timer <= diff) + { + // have the victim cast the spell on himself otherwise the third effect aura will be applied + // to Vael instead of the player + me->getVictim()->CastSpell(me->getVictim(),SPELL_BURNINGADRENALINE,1); -bool GossipSelect_boss_vael(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) -{ - if (uiSender == GOSSIP_SENDER_MAIN) - SendDefaultMenu_boss_vael(pPlayer, pCreature, uiAction); + BurningAdrenalineTank_Timer = 45000; + } else BurningAdrenalineTank_Timer -= diff; - return true; -} + //FireNova_Timer + if (FireNova_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_FIRENOVA); + FireNova_Timer = 5000; + } else FireNova_Timer -= diff; -bool GossipHello_boss_vael(Player* pPlayer, Creature* pCreature) -{ - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + //TailSwipe_Timer + if (TailSwipe_Timer <= diff) + { + //Only cast if we are behind + /*if (!me->HasInArc(M_PI, me->getVictim())) + { + DoCast(me->getVictim(), SPELL_TAILSWIPE); + }*/ - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - pPlayer->SEND_GOSSIP_MENU(907, pCreature->GetGUID()); + TailSwipe_Timer = 20000; + } else TailSwipe_Timer -= diff; - return true; -} + DoMeleeAttackIfReady(); + } + }; -CreatureAI* GetAI_boss_vael(Creature* pCreature) -{ - return new boss_vaelAI (pCreature); -} +}; void AddSC_boss_vael() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_vaelastrasz"; - newscript->GetAI = &GetAI_boss_vael; - newscript->pGossipHello = &GossipHello_boss_vael; - newscript->pGossipSelect = &GossipSelect_boss_vael; - newscript->RegisterSelf(); + new boss_vaelastrasz(); } - diff --git a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_victor_nefarius.cpp b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_victor_nefarius.cpp index d6a31cda4af..1c5afd1793b 100644 --- a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_victor_nefarius.cpp +++ b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_victor_nefarius.cpp @@ -68,320 +68,321 @@ EndScriptData */ //and allow players to start the event over //If nefarian dies then he will kill himself then he will kill himself in his hiding place //To prevent players from doing the event twice - -struct boss_victor_nefariusAI : public ScriptedAI +
class boss_victor_nefarius : public CreatureScript { - boss_victor_nefariusAI(Creature *c) : ScriptedAI(c) +public: + boss_victor_nefarius() : CreatureScript("boss_victor_nefarius") { } + + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - NefarianGUID = 0; - switch (urand(0,19)) + switch (uiAction) { - case 0: - DrakType1 = CREATURE_BRONZE_DRAKANOID; - DrakType2 = CREATURE_BLUE_DRAKANOID; - break; - case 1: - DrakType1 = CREATURE_BRONZE_DRAKANOID; - DrakType2 = CREATURE_RED_DRAKANOID; - break; - case 2: - DrakType1 = CREATURE_BRONZE_DRAKANOID; - DrakType2 = CREATURE_GREEN_DRAKANOID; - break; - case 3: - DrakType1 = CREATURE_BRONZE_DRAKANOID; - DrakType2 = CREATURE_BLACK_DRAKANOID; - break; - case 4: - DrakType1 = CREATURE_BLUE_DRAKANOID; - DrakType2 = CREATURE_BRONZE_DRAKANOID; - break; - case 5: - DrakType1 = CREATURE_BLUE_DRAKANOID; - DrakType2 = CREATURE_RED_DRAKANOID; - break; - case 6: - DrakType1 = CREATURE_BLUE_DRAKANOID; - DrakType2 = CREATURE_GREEN_DRAKANOID; - break; - case 7: - DrakType1 = CREATURE_BLUE_DRAKANOID; - DrakType2 = CREATURE_BLACK_DRAKANOID; - break; - case 8: - DrakType1 = CREATURE_RED_DRAKANOID; - DrakType2 = CREATURE_BRONZE_DRAKANOID; - break; - case 9: - DrakType1 = CREATURE_RED_DRAKANOID; - DrakType2 = CREATURE_BLUE_DRAKANOID; - break; - case 10: - DrakType1 = CREATURE_RED_DRAKANOID; - DrakType2 = CREATURE_GREEN_DRAKANOID; - break; - case 11: - DrakType1 = CREATURE_RED_DRAKANOID; - DrakType2 = CREATURE_BLACK_DRAKANOID; - break; - case 12: - DrakType1 = CREATURE_GREEN_DRAKANOID; - DrakType2 = CREATURE_BRONZE_DRAKANOID; - break; - case 13: - DrakType1 = CREATURE_GREEN_DRAKANOID; - DrakType2 = CREATURE_BLUE_DRAKANOID; - break; - case 14: - DrakType1 = CREATURE_GREEN_DRAKANOID; - DrakType2 = CREATURE_RED_DRAKANOID; - break; - case 15: - DrakType1 = CREATURE_GREEN_DRAKANOID; - DrakType2 = CREATURE_BLACK_DRAKANOID; + case GOSSIP_ACTION_INFO_DEF+1: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); + pPlayer->SEND_GOSSIP_MENU(7198, pCreature->GetGUID()); break; - case 16: - DrakType1 = CREATURE_BLACK_DRAKANOID; - DrakType2 = CREATURE_BRONZE_DRAKANOID; + case GOSSIP_ACTION_INFO_DEF+2: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); + pPlayer->SEND_GOSSIP_MENU(7199, pCreature->GetGUID()); break; - case 17: - DrakType1 = CREATURE_BLACK_DRAKANOID; - DrakType2 = CREATURE_BLUE_DRAKANOID; - break; - case 18: - DrakType1 = CREATURE_BLACK_DRAKANOID; - DrakType2 = CREATURE_GREEN_DRAKANOID; - break; - case 19: - DrakType1 = CREATURE_BLACK_DRAKANOID; - DrakType2 = CREATURE_RED_DRAKANOID; + case GOSSIP_ACTION_INFO_DEF+3: + pPlayer->CLOSE_GOSSIP_MENU(); + DoScriptText(SAY_GAMESBEGIN_1, pCreature); + CAST_AI(boss_victor_nefarius::boss_victor_nefariusAI, pCreature->AI())->BeginEvent(pPlayer); break; } + return true; } - uint32 SpawnedAdds; - uint32 AddSpawnTimer; - uint32 ShadowBoltTimer; - uint32 FearTimer; - uint32 MindControlTimer; - uint32 ResetTimer; - uint32 DrakType1; - uint32 DrakType2; - uint64 NefarianGUID; - uint32 NefCheckTime; - - void Reset() + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - SpawnedAdds = 0; - AddSpawnTimer = 10000; - ShadowBoltTimer = 5000; - FearTimer = 8000; - ResetTimer = 900000; //On official it takes him 15 minutes(900 seconds) to reset. We are only doing 1 minute to make testing easier - NefarianGUID = 0; - NefCheckTime = 2000; - - me->SetUInt32Value(UNIT_NPC_FLAGS,1); - me->setFaction(35); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_1 , GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + pPlayer->SEND_GOSSIP_MENU(7134, pCreature->GetGUID()); + return true; } - void BeginEvent(Player *pTarget) + CreatureAI* GetAI(Creature* pCreature) const { - DoScriptText(SAY_GAMESBEGIN_2, me); + return new boss_victor_nefariusAI (pCreature); + } - //Trinity::Singleton<MapManager>::Instance().GetMap(me->GetMapId(), me)->GetPlayers().begin(); - /* - list <Player*>::const_iterator i = sMapMgr.GetMap(me->GetMapId(), me)->GetPlayers().begin(); + struct boss_victor_nefariusAI : public ScriptedAI + { + boss_victor_nefariusAI(Creature *c) : ScriptedAI(c) + { + NefarianGUID = 0; + switch (urand(0,19)) + { + case 0: + DrakType1 = CREATURE_BRONZE_DRAKANOID; + DrakType2 = CREATURE_BLUE_DRAKANOID; + break; + case 1: + DrakType1 = CREATURE_BRONZE_DRAKANOID; + DrakType2 = CREATURE_RED_DRAKANOID; + break; + case 2: + DrakType1 = CREATURE_BRONZE_DRAKANOID; + DrakType2 = CREATURE_GREEN_DRAKANOID; + break; + case 3: + DrakType1 = CREATURE_BRONZE_DRAKANOID; + DrakType2 = CREATURE_BLACK_DRAKANOID; + break; + case 4: + DrakType1 = CREATURE_BLUE_DRAKANOID; + DrakType2 = CREATURE_BRONZE_DRAKANOID; + break; + case 5: + DrakType1 = CREATURE_BLUE_DRAKANOID; + DrakType2 = CREATURE_RED_DRAKANOID; + break; + case 6: + DrakType1 = CREATURE_BLUE_DRAKANOID; + DrakType2 = CREATURE_GREEN_DRAKANOID; + break; + case 7: + DrakType1 = CREATURE_BLUE_DRAKANOID; + DrakType2 = CREATURE_BLACK_DRAKANOID; + break; + case 8: + DrakType1 = CREATURE_RED_DRAKANOID; + DrakType2 = CREATURE_BRONZE_DRAKANOID; + break; + case 9: + DrakType1 = CREATURE_RED_DRAKANOID; + DrakType2 = CREATURE_BLUE_DRAKANOID; + break; + case 10: + DrakType1 = CREATURE_RED_DRAKANOID; + DrakType2 = CREATURE_GREEN_DRAKANOID; + break; + case 11: + DrakType1 = CREATURE_RED_DRAKANOID; + DrakType2 = CREATURE_BLACK_DRAKANOID; + break; + case 12: + DrakType1 = CREATURE_GREEN_DRAKANOID; + DrakType2 = CREATURE_BRONZE_DRAKANOID; + break; + case 13: + DrakType1 = CREATURE_GREEN_DRAKANOID; + DrakType2 = CREATURE_BLUE_DRAKANOID; + break; + case 14: + DrakType1 = CREATURE_GREEN_DRAKANOID; + DrakType2 = CREATURE_RED_DRAKANOID; + break; + case 15: + DrakType1 = CREATURE_GREEN_DRAKANOID; + DrakType2 = CREATURE_BLACK_DRAKANOID; + break; + case 16: + DrakType1 = CREATURE_BLACK_DRAKANOID; + DrakType2 = CREATURE_BRONZE_DRAKANOID; + break; + case 17: + DrakType1 = CREATURE_BLACK_DRAKANOID; + DrakType2 = CREATURE_BLUE_DRAKANOID; + break; + case 18: + DrakType1 = CREATURE_BLACK_DRAKANOID; + DrakType2 = CREATURE_GREEN_DRAKANOID; + break; + case 19: + DrakType1 = CREATURE_BLACK_DRAKANOID; + DrakType2 = CREATURE_RED_DRAKANOID; + break; + } + } - for (i = sMapMgr.GetMap(me->GetMapId(), me)->GetPlayers().begin(); i != sMapMgr.GetMap(me->GetMapId(), me)->GetPlayers().end(); ++i) + uint32 SpawnedAdds; + uint32 AddSpawnTimer; + uint32 ShadowBoltTimer; + uint32 FearTimer; + uint32 MindControlTimer; + uint32 ResetTimer; + uint32 DrakType1; + uint32 DrakType2; + uint64 NefarianGUID; + uint32 NefCheckTime; + + void Reset() { - AttackStart((*i)); + SpawnedAdds = 0; + AddSpawnTimer = 10000; + ShadowBoltTimer = 5000; + FearTimer = 8000; + ResetTimer = 900000; //On official it takes him 15 minutes(900 seconds) to reset. We are only doing 1 minute to make testing easier + NefarianGUID = 0; + NefCheckTime = 2000; + + me->SetUInt32Value(UNIT_NPC_FLAGS,1); + me->setFaction(35); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); } - */ - me->SetUInt32Value(UNIT_NPC_FLAGS,0); - me->setFaction(103); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - AttackStart(pTarget); - } - void EnterCombat(Unit * /*who*/) - { - } + void BeginEvent(Player *pTarget) + { + DoScriptText(SAY_GAMESBEGIN_2, me); - void MoveInLineOfSight(Unit *who) - { - //We simply use this function to find players until we can use pMap->GetPlayers() + //Trinity::Singleton<MapManager>::Instance().GetMap(me->GetMapId(), me)->GetPlayers().begin(); + /* + list <Player*>::const_iterator i = sMapMgr.GetMap(me->GetMapId(), me)->GetPlayers().begin(); - if (who && who->GetTypeId() == TYPEID_PLAYER && me->IsHostileTo(who)) - { - //Add them to our threat list - me->AddThreat(who, 0.0f); + for (i = sMapMgr.GetMap(me->GetMapId(), me)->GetPlayers().begin(); i != sMapMgr.GetMap(me->GetMapId(), me)->GetPlayers().end(); ++i) + { + AttackStart((*i)); + } + */ + me->SetUInt32Value(UNIT_NPC_FLAGS,0); + me->setFaction(103); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + AttackStart(pTarget); } - } - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - //Only do this if we haven't spawned nef yet - if (SpawnedAdds < 42) + void EnterCombat(Unit * /*who*/) { - //ShadowBoltTimer - if (ShadowBoltTimer <= diff) - { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(pTarget, SPELL_SHADOWBOLT); + } - ShadowBoltTimer = urand(3000,10000); - } else ShadowBoltTimer -= diff; + void MoveInLineOfSight(Unit *who) + { + //We simply use this function to find players until we can use pMap->GetPlayers() - //FearTimer - if (FearTimer <= diff) + if (who && who->GetTypeId() == TYPEID_PLAYER && me->IsHostileTo(who)) { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(pTarget, SPELL_FEAR); + //Add them to our threat list + me->AddThreat(who, 0.0f); + } + } - FearTimer = 10000 + (rand()%10000); - } else FearTimer -= diff; + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; - //Add spawning mechanism - if (AddSpawnTimer <= diff) + //Only do this if we haven't spawned nef yet + if (SpawnedAdds < 42) { - //Spawn 2 random types of creatures at the 2 locations - uint32 CreatureID; - Creature* Spawned = NULL; - Unit *pTarget = NULL; - - //1 in 3 chance it will be a chromatic - if (urand(0,2) == 0) - CreatureID = CREATURE_CHROMATIC_DRAKANOID; - else - CreatureID = DrakType1; - - ++SpawnedAdds; - - //Spawn Creature and force it to start attacking a random target - Spawned = me->SummonCreature(CreatureID,ADD_X1,ADD_Y1,ADD_Z1,5.000,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); - pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); - if (pTarget && Spawned) + //ShadowBoltTimer + if (ShadowBoltTimer <= diff) { - Spawned->AI()->AttackStart(pTarget); - Spawned->setFaction(103); - } + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + DoCast(pTarget, SPELL_SHADOWBOLT); - //1 in 3 chance it will be a chromatic - if (urand(0,2) == 0) - CreatureID = CREATURE_CHROMATIC_DRAKANOID; - else - CreatureID = DrakType2; + ShadowBoltTimer = urand(3000,10000); + } else ShadowBoltTimer -= diff; - ++SpawnedAdds; - - Spawned = me->SummonCreature(CreatureID,ADD_X2,ADD_Y2,ADD_Z2,5.000,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); - pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); - if (pTarget && Spawned) + //FearTimer + if (FearTimer <= diff) { - Spawned->AI()->AttackStart(pTarget); - Spawned->setFaction(103); - } + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + DoCast(pTarget, SPELL_FEAR); + + FearTimer = 10000 + (rand()%10000); + } else FearTimer -= diff; - //Begin phase 2 by spawning Nefarian and what not - if (SpawnedAdds >= 42) + //Add spawning mechanism + if (AddSpawnTimer <= diff) { - //Teleport Victor Nefarius way out of the map - //sMapMgr.GetMap(me->GetMapId(), me)->CreatureRelocation(me,0,0,-5000,0); + //Spawn 2 random types of creatures at the 2 locations + uint32 CreatureID; + Creature* Spawned = NULL; + Unit *pTarget = NULL; - //Interrupt any spell casting - me->InterruptNonMeleeSpells(false); + //1 in 3 chance it will be a chromatic + if (urand(0,2) == 0) + CreatureID = CREATURE_CHROMATIC_DRAKANOID; + else + CreatureID = DrakType1; - //Root self - DoCast(me, 33356); + ++SpawnedAdds; - //Make super invis - DoCast(me, 8149); + //Spawn Creature and force it to start attacking a random target + Spawned = me->SummonCreature(CreatureID,ADD_X1,ADD_Y1,ADD_Z1,5.000,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); + pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); + if (pTarget && Spawned) + { + Spawned->AI()->AttackStart(pTarget); + Spawned->setFaction(103); + } + + //1 in 3 chance it will be a chromatic + if (urand(0,2) == 0) + CreatureID = CREATURE_CHROMATIC_DRAKANOID; + else + CreatureID = DrakType2; - //Teleport self to a hiding spot (this causes errors in the Trinity log but no real issues) - DoTeleportTo(HIDE_X,HIDE_Y,HIDE_Z); - me->addUnitState(UNIT_STAT_FLEEING); + ++SpawnedAdds; - //Spawn nef and have him attack a random target - Creature* Nefarian = me->SummonCreature(CREATURE_NEFARIAN,NEF_X,NEF_Y,NEF_Z,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,120000); + Spawned = me->SummonCreature(CreatureID,ADD_X2,ADD_Y2,ADD_Z2,5.000,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); - if (pTarget && Nefarian) + if (pTarget && Spawned) { - Nefarian->AI()->AttackStart(pTarget); - Nefarian->setFaction(103); - NefarianGUID = Nefarian->GetGUID(); + Spawned->AI()->AttackStart(pTarget); + Spawned->setFaction(103); } - else sLog.outError("TSCR: Blackwing Lair: Unable to spawn nefarian properly."); - } - AddSpawnTimer = 4000; - } else AddSpawnTimer -= diff; - } - else if (NefarianGUID) - { - if (NefCheckTime <= diff) - { - Unit* Nefarian = Unit::GetCreature((*me),NefarianGUID); + //Begin phase 2 by spawning Nefarian and what not + if (SpawnedAdds >= 42) + { + //Teleport Victor Nefarius way out of the map + //sMapMgr.GetMap(me->GetMapId(), me)->CreatureRelocation(me,0,0,-5000,0); + + //Interrupt any spell casting + me->InterruptNonMeleeSpells(false); + + //Root self + DoCast(me, 33356); + + //Make super invis + DoCast(me, 8149); + + //Teleport self to a hiding spot (this causes errors in the Trinity log but no real issues) + DoTeleportTo(HIDE_X,HIDE_Y,HIDE_Z); + me->addUnitState(UNIT_STAT_FLEEING); + + //Spawn nef and have him attack a random target + Creature* Nefarian = me->SummonCreature(CREATURE_NEFARIAN,NEF_X,NEF_Y,NEF_Z,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,120000); + pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); + if (pTarget && Nefarian) + { + Nefarian->AI()->AttackStart(pTarget); + Nefarian->setFaction(103); + NefarianGUID = Nefarian->GetGUID(); + } + else sLog.outError("TSCR: Blackwing Lair: Unable to spawn nefarian properly."); + } - //If nef is dead then we die to so the players get out of combat - //and cannot repeat the event - if (!Nefarian || !Nefarian->isAlive()) + AddSpawnTimer = 4000; + } else AddSpawnTimer -= diff; + } + else if (NefarianGUID) + { + if (NefCheckTime <= diff) { - NefarianGUID = 0; - me->ForcedDespawn(); - } + Unit* Nefarian = Unit::GetCreature((*me),NefarianGUID); + + //If nef is dead then we die to so the players get out of combat + //and cannot repeat the event + if (!Nefarian || !Nefarian->isAlive()) + { + NefarianGUID = 0; + me->ForcedDespawn(); + } - NefCheckTime = 2000; - } else NefCheckTime -= diff; + NefCheckTime = 2000; + } else NefCheckTime -= diff; + } } - } + }; + }; -CreatureAI* GetAI_boss_victor_nefarius(Creature* pCreature) -{ - return new boss_victor_nefariusAI (pCreature); -} -bool GossipHello_boss_victor_nefarius(Player* pPlayer, Creature* pCreature) -{ - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_1 , GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(7134, pCreature->GetGUID()); - return true; -} -bool GossipSelect_boss_victor_nefarius(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - switch (uiAction) - { - case GOSSIP_ACTION_INFO_DEF+1: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); - pPlayer->SEND_GOSSIP_MENU(7198, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+2: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); - pPlayer->SEND_GOSSIP_MENU(7199, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+3: - pPlayer->CLOSE_GOSSIP_MENU(); - DoScriptText(SAY_GAMESBEGIN_1, pCreature); - CAST_AI(boss_victor_nefariusAI, pCreature->AI())->BeginEvent(pPlayer); - break; - } - return true; -} void AddSC_boss_victor_nefarius() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_victor_nefarius"; - newscript->GetAI = &GetAI_boss_victor_nefarius; - newscript->pGossipHello = &GossipHello_boss_victor_nefarius; - newscript->pGossipSelect = &GossipSelect_boss_victor_nefarius; - newscript->RegisterSelf(); + new boss_victor_nefarius(); } - diff --git a/src/server/scripts/EasternKingdoms/Deadmines/boss_mr_smite.cpp b/src/server/scripts/EasternKingdoms/Deadmines/boss_mr_smite.cpp index 77fb826e9dd..ad8be719660 100644 --- a/src/server/scripts/EasternKingdoms/Deadmines/boss_mr_smite.cpp +++ b/src/server/scripts/EasternKingdoms/Deadmines/boss_mr_smite.cpp @@ -36,146 +36,149 @@ enum eSpels SAY_AGGRO = -1036001 }; - -struct boss_mr_smiteAI : public ScriptedAI +
class boss_mr_smite : public CreatureScript { - boss_mr_smiteAI(Creature* pCreature) : ScriptedAI(pCreature) +public: + boss_mr_smite() : CreatureScript("boss_mr_smite") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = pCreature->GetInstanceData(); + return new boss_mr_smiteAI (pCreature); } - ScriptedInstance* pInstance; - - uint32 uiTrashTimer; - uint32 uiSlamTimer; - uint32 uiNimbleReflexesTimer; - - uint8 uiHealth; - - uint32 uiPhase; - uint32 uiTimer; - - void Reset() + struct boss_mr_smiteAI : public ScriptedAI { - uiTrashTimer = urand(5000,9000); - uiSlamTimer = 9000; - uiNimbleReflexesTimer = urand(15500,31600); + boss_mr_smiteAI(Creature* pCreature) : ScriptedAI(pCreature) + { + pInstance = pCreature->GetInstanceScript(); + } - uiHealth = 0; + InstanceScript* pInstance; - uiPhase = 0; - uiTimer = 0; + uint32 uiTrashTimer; + uint32 uiSlamTimer; + uint32 uiNimbleReflexesTimer; - SetEquipmentSlots(false, EQUIP_SWORD, EQUIP_UNEQUIP, EQUIP_NO_CHANGE); - } + uint8 uiHealth; - void EnterCombat(Unit* /*pWho*/) - { - DoScriptText(SAY_AGGRO, me); - } + uint32 uiPhase; + uint32 uiTimer; - bool bCheckChances() - { - uint32 uiChances = urand(0,99); - if (uiChances <= 15) - return false; - else - return true; - } + void Reset() + { + uiTrashTimer = urand(5000,9000); + uiSlamTimer = 9000; + uiNimbleReflexesTimer = urand(15500,31600); - void UpdateAI(const uint32 uiDiff) - { - if (!UpdateVictim()) - return; + uiHealth = 0; - /*START ACID-AI*/ - if (uiTrashTimer <= uiDiff) - { - if (bCheckChances()) - DoCast(me, SPELL_TRASH); - uiTrashTimer = urand(6000,15500); - } else uiTrashTimer -= uiDiff; + uiPhase = 0; + uiTimer = 0; - if (uiSlamTimer <= uiDiff) - { - if (bCheckChances()) - DoCast(me->getVictim(), SPELL_SMITE_SLAM); - uiSlamTimer = 11000; - } else uiSlamTimer -= uiDiff; + SetEquipmentSlots(false, EQUIP_SWORD, EQUIP_UNEQUIP, EQUIP_NO_CHANGE); + } - if (uiNimbleReflexesTimer <= uiDiff) + void EnterCombat(Unit* /*pWho*/) { - if (bCheckChances()) - DoCast(me, SPELL_NIMBLE_REFLEXES); - uiNimbleReflexesTimer = urand(27300,60100); - } else uiNimbleReflexesTimer -= uiDiff; - /*END ACID-AI*/ + DoScriptText(SAY_AGGRO, me); + } - if (uiHealth == 0 && me->GetHealth()*100 / me->GetMaxHealth() <= 66 || uiHealth == 1 && me->GetHealth()*100 / me->GetMaxHealth() <= 33) + bool bCheckChances() { - ++uiHealth; - DoCastAOE(SPELL_SMITE_STOMP,false); - SetCombatMovement(false); - if (pInstance) - if (GameObject* pGo = GameObject::GetGameObject((*me),pInstance->GetData64(DATA_SMITE_CHEST))) - { - me->GetMotionMaster()->Clear(); - me->GetMotionMaster()->MovePoint(1,-3.00+pGo->GetPositionX(),pGo->GetPositionY(),pGo->GetPositionZ()); - } + uint32 uiChances = urand(0,99); + if (uiChances <= 15) + return false; + else + return true; } - if (uiPhase) + void UpdateAI(const uint32 uiDiff) { - if (uiTimer <= uiDiff) + if (!UpdateVictim()) + return; + + /*START ACID-AI*/ + if (uiTrashTimer <= uiDiff) + { + if (bCheckChances()) + DoCast(me, SPELL_TRASH); + uiTrashTimer = urand(6000,15500); + } else uiTrashTimer -= uiDiff; + + if (uiSlamTimer <= uiDiff) + { + if (bCheckChances()) + DoCast(me->getVictim(), SPELL_SMITE_SLAM); + uiSlamTimer = 11000; + } else uiSlamTimer -= uiDiff; + + if (uiNimbleReflexesTimer <= uiDiff) + { + if (bCheckChances()) + DoCast(me, SPELL_NIMBLE_REFLEXES); + uiNimbleReflexesTimer = urand(27300,60100); + } else uiNimbleReflexesTimer -= uiDiff; + /*END ACID-AI*/ + + if (uiHealth == 0 && me->GetHealth()*100 / me->GetMaxHealth() <= 66 || uiHealth == 1 && me->GetHealth()*100 / me->GetMaxHealth() <= 33) { - switch(uiPhase) + ++uiHealth; + DoCastAOE(SPELL_SMITE_STOMP,false); + SetCombatMovement(false); + if (pInstance) + if (GameObject* pGo = GameObject::GetGameObject((*me),pInstance->GetData64(DATA_SMITE_CHEST))) + { + me->GetMotionMaster()->Clear(); + me->GetMotionMaster()->MovePoint(1,-3.00+pGo->GetPositionX(),pGo->GetPositionY(),pGo->GetPositionZ()); + } + } + + if (uiPhase) + { + if (uiTimer <= uiDiff) { - case 1: - me->HandleEmoteCommand(EMOTE_STATE_KNEEL); //dosen't work? - uiTimer = 1000; - uiPhase = 2; - break; - case 2: - if (uiHealth == 1) - SetEquipmentSlots(false, EQUIP_SWORD, EQUIP_SWORD, EQUIP_NO_CHANGE); - else - SetEquipmentSlots(false, EQUIP_MACE, EQUIP_UNEQUIP, EQUIP_NO_CHANGE); - uiTimer = 500; - uiPhase = 3; - break; - case 3: - SetCombatMovement(true); - me->GetMotionMaster()->MoveChase(me->getVictim(), me->m_CombatDistance); - uiPhase = 0; - break; - - } - } else uiTimer -= uiDiff; + switch(uiPhase) + { + case 1: + me->HandleEmoteCommand(EMOTE_STATE_KNEEL); //dosen't work? + uiTimer = 1000; + uiPhase = 2; + break; + case 2: + if (uiHealth == 1) + SetEquipmentSlots(false, EQUIP_SWORD, EQUIP_SWORD, EQUIP_NO_CHANGE); + else + SetEquipmentSlots(false, EQUIP_MACE, EQUIP_UNEQUIP, EQUIP_NO_CHANGE); + uiTimer = 500; + uiPhase = 3; + break; + case 3: + SetCombatMovement(true); + me->GetMotionMaster()->MoveChase(me->getVictim(), me->m_CombatDistance); + uiPhase = 0; + break; + + } + } else uiTimer -= uiDiff; + } + + DoMeleeAttackIfReady(); } - DoMeleeAttackIfReady(); - } + void MovementInform(uint32 uiType, uint32 /*uiId*/) + { + if (uiType != POINT_MOTION_TYPE) + return; - void MovementInform(uint32 uiType, uint32 /*uiId*/) - { - if (uiType != POINT_MOTION_TYPE) - return; + uiTimer = 1500; + uiPhase = 1; + } - uiTimer = 1500; - uiPhase = 1; - } + }; }; -CreatureAI* GetAI_boss_mr_smite(Creature* pCreature) -{ - return new boss_mr_smiteAI (pCreature); -} void AddSC_boss_mr_smite() { - Script* newscript; - newscript = new Script; - newscript->Name = "boss_mr_smite"; - newscript->GetAI = &GetAI_boss_mr_smite; - newscript->RegisterSelf(); + new boss_mr_smite(); } diff --git a/src/server/scripts/EasternKingdoms/Deadmines/deadmines.cpp b/src/server/scripts/EasternKingdoms/Deadmines/deadmines.cpp index 0540ae7194d..a94f264d96b 100644 --- a/src/server/scripts/EasternKingdoms/Deadmines/deadmines.cpp +++ b/src/server/scripts/EasternKingdoms/Deadmines/deadmines.cpp @@ -30,33 +30,35 @@ EndScriptData */ /*##### # item_Defias_Gunpowder #####*/ - -bool ItemUse_item_defias_gunpowder(Player* pPlayer, Item* pItem, SpellCastTargets const& targets) +
class item_defias_gunpowder : public ItemScript { - ScriptedInstance *pInstance = pPlayer->GetInstanceData(); +public: + item_defias_gunpowder() : ItemScript("item_defias_gunpowder") { } - if (!pInstance) + bool ItemUse(Player* pPlayer, Item* pItem, SpellCastTargets const& targets) { - pPlayer->GetSession()->SendNotification("Instance script not initialized"); + InstanceScript *pInstance = pPlayer->GetInstanceScript(); + + if (!pInstance) + { + pPlayer->GetSession()->SendNotification("Instance script not initialized"); + return true; + } + if (pInstance->GetData(EVENT_STATE)!= CANNON_NOT_USED) + return false; + if (targets.getGOTarget() && targets.getGOTarget()->GetTypeId() == TYPEID_GAMEOBJECT && + targets.getGOTarget()->GetEntry() == GO_DEFIAS_CANNON) + { + pInstance->SetData(EVENT_STATE, CANNON_GUNPOWDER_USED); + } + + pPlayer->DestroyItemCount(pItem->GetEntry(), 1, true); return true; } - if (pInstance->GetData(EVENT_STATE)!= CANNON_NOT_USED) - return false; - if (targets.getGOTarget() && targets.getGOTarget()->GetTypeId() == TYPEID_GAMEOBJECT && - targets.getGOTarget()->GetEntry() == GO_DEFIAS_CANNON) - { - pInstance->SetData(EVENT_STATE, CANNON_GUNPOWDER_USED); - } - pPlayer->DestroyItemCount(pItem->GetEntry(), 1, true); - return true; -} +}; void AddSC_deadmines() { - Script *newscript; - newscript = new Script; - newscript->Name = "item_defias_gunpowder"; - newscript->pItemUse = &ItemUse_item_defias_gunpowder; - newscript->RegisterSelf(); + new item_defias_gunpowder(); } diff --git a/src/server/scripts/EasternKingdoms/Deadmines/instance_deadmines.cpp b/src/server/scripts/EasternKingdoms/Deadmines/instance_deadmines.cpp index 4d5c11fa9f5..1a0686cfc3f 100644 --- a/src/server/scripts/EasternKingdoms/Deadmines/instance_deadmines.cpp +++ b/src/server/scripts/EasternKingdoms/Deadmines/instance_deadmines.cpp @@ -51,9 +51,9 @@ class instance_deadmines : public InstanceMapScript { } - struct instance_deadmines_InstanceMapScript : public ScriptedInstance + struct instance_deadmines_InstanceMapScript : public InstanceScript { - instance_deadmines_InstanceMapScript(Map* pMap) : ScriptedInstance(pMap) { Initialize(); }; + instance_deadmines_InstanceMapScript(Map* pMap) : InstanceScript(pMap) { Initialize(); }; uint64 FactoryDoorGUID; uint64 IronCladDoorGUID; @@ -251,7 +251,7 @@ class instance_deadmines : public InstanceMapScript } }; - InstanceData* GetInstanceData(InstanceMap* pMap) const + InstanceScript* GetInstanceScript(InstanceMap* pMap) const { return new instance_deadmines_InstanceMapScript(pMap); } diff --git a/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp b/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp index 776515891e4..3c85cc8b415 100644 --- a/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp +++ b/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp @@ -84,509 +84,514 @@ const Position SpawnPosition[] = {-495.240,-90.808,-149.493,3.238}, {-494.195,-89.553,-149.131,3.254} }; - -struct npc_blastmaster_emi_shortfuseAI : public npc_escortAI +
class npc_blastmaster_emi_shortfuse : public CreatureScript { - npc_blastmaster_emi_shortfuseAI(Creature* pCreature) : npc_escortAI(pCreature) +public: + npc_blastmaster_emi_shortfuse() : CreatureScript("npc_blastmaster_emi_shortfuse") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = pCreature->GetInstanceData(); - pCreature->RestoreFaction(); - Reset(); + return new npc_blastmaster_emi_shortfuseAI(pCreature); } - ScriptedInstance* pInstance; - - uint8 uiPhase; - uint32 uiTimer; - - std::list<uint64> SummonList; - std::list<uint64> GoSummonList; - - void Reset() + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - if (!HasEscortState(STATE_ESCORT_ESCORTING)) + if (uiAction == GOSSIP_ACTION_INFO_DEF+1) { - uiTimer = 0; - uiPhase = 0; + if (npc_escortAI* pEscortAI = CAST_AI(npc_blastmaster_emi_shortfuse::npc_blastmaster_emi_shortfuseAI, pCreature->AI())) + pEscortAI->Start(true, false,pPlayer->GetGUID()); - RestoreAll(); + pCreature->setFaction(pPlayer->getFaction()); + pCreature->AI()->SetData(1,0); - SummonList.clear(); - GoSummonList.clear(); + pPlayer->CLOSE_GOSSIP_MENU(); } + return true; } - void NextStep(uint32 uiTimerStep,bool bNextStep = true,uint8 uiPhaseStep = 0) + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - uiTimer = uiTimerStep; - if (bNextStep) - ++uiPhase; - else - uiPhase = uiPhaseStep; - } + InstanceScript* pInstance = pCreature->GetInstanceScript(); - void CaveDestruction(bool bBool) - { - if (GoSummonList.empty()) - return; + if (pInstance && pInstance->GetData(TYPE_EVENT) == NOT_STARTED) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_START_EVENT, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - for (std::list<uint64>::const_iterator itr = GoSummonList.begin(); itr != GoSummonList.end(); ++itr) - { - if (GameObject* pGo = GameObject::GetGameObject(*me, *itr)) - { - if (pGo) - { - if (Creature *trigger = pGo->SummonTrigger(pGo->GetPositionX(), pGo->GetPositionY(),pGo->GetPositionZ(), 0, 1)) - { - //visual effects are not working! ¬¬ - trigger->CastSpell(trigger,11542,true); - trigger->CastSpell(trigger,35470,true); - } - pGo->RemoveFromWorld(); - //pGo->CastSpell(me,12158); makes all die?! - } - } - } + pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXT_EMI, pCreature->GetGUID()); - if (bBool) - { - if (pInstance) - if (GameObject* pGo = GameObject::GetGameObject((*me),pInstance->GetData64(DATA_GO_CAVE_IN_RIGHT))) - pInstance->HandleGameObject(NULL,false,pGo); - }else - if (pInstance) - if (GameObject* pGo = GameObject::GetGameObject((*me),pInstance->GetData64(DATA_GO_CAVE_IN_LEFT))) - pInstance->HandleGameObject(NULL,false,pGo); + return true; } - void SetInFace(bool bBool) + struct npc_blastmaster_emi_shortfuseAI : public npc_escortAI { - if (!pInstance) - return; - - if (bBool) + npc_blastmaster_emi_shortfuseAI(Creature* pCreature) : npc_escortAI(pCreature) { - if (GameObject* pGo = GameObject::GetGameObject((*me),pInstance->GetData64(DATA_GO_CAVE_IN_RIGHT))) - me->SetFacingToObject(pGo); - }else - if (GameObject* pGo = GameObject::GetGameObject((*me),pInstance->GetData64(DATA_GO_CAVE_IN_LEFT))) - me->SetFacingToObject(pGo); - } + pInstance = pCreature->GetInstanceScript(); + pCreature->RestoreFaction(); + Reset(); + } - void RestoreAll() - { - if (!pInstance) - return; + InstanceScript* pInstance; - if (GameObject* pGo = GameObject::GetGameObject((*me),pInstance->GetData64(DATA_GO_CAVE_IN_RIGHT))) - pInstance->HandleGameObject(NULL,false,pGo); + uint8 uiPhase; + uint32 uiTimer; - if (GameObject* pGo = GameObject::GetGameObject((*me),pInstance->GetData64(DATA_GO_CAVE_IN_LEFT))) - pInstance->HandleGameObject(NULL,false,pGo); + std::list<uint64> SummonList; + std::list<uint64> GoSummonList; - if (!GoSummonList.empty()) - for (std::list<uint64>::const_iterator itr = GoSummonList.begin(); itr != GoSummonList.end(); ++itr) + void Reset() + { + if (!HasEscortState(STATE_ESCORT_ESCORTING)) { - if (GameObject* pGo = GameObject::GetGameObject(*me, *itr)) - pGo->RemoveFromWorld(); - } + uiTimer = 0; + uiPhase = 0; - if (!SummonList.empty()) - for (std::list<uint64>::const_iterator itr = SummonList.begin(); itr != SummonList.end(); ++itr) - { - if (Creature* pSummon = Unit::GetCreature(*me, *itr)) - { - if (pSummon->isAlive()) - pSummon->DisappearAndDie(); - else - pSummon->RemoveCorpse(); - } - } - } + RestoreAll(); - void AggroAllPlayers(Creature* pTemp) - { - Map::PlayerList const &PlList = me->GetMap()->GetPlayers(); + SummonList.clear(); + GoSummonList.clear(); + } + } - if (PlList.isEmpty()) - return; + void NextStep(uint32 uiTimerStep,bool bNextStep = true,uint8 uiPhaseStep = 0) + { + uiTimer = uiTimerStep; + if (bNextStep) + ++uiPhase; + else + uiPhase = uiPhaseStep; + } - for (Map::PlayerList::const_iterator i = PlList.begin(); i != PlList.end(); ++i) + void CaveDestruction(bool bBool) { - if (Player* pPlayer = i->getSource()) - { - if (pPlayer->isGameMaster()) - continue; + if (GoSummonList.empty()) + return; - if (pPlayer->isAlive()) - { - pTemp->SetInCombatWith(pPlayer); - pPlayer->SetInCombatWith(pTemp); - pTemp->AddThreat(pPlayer, 0.0f); - } + for (std::list<uint64>::const_iterator itr = GoSummonList.begin(); itr != GoSummonList.end(); ++itr) + { + if (GameObject* pGo = GameObject::GetGameObject(*me, *itr)) + { + if (pGo) + { + if (Creature *trigger = pGo->SummonTrigger(pGo->GetPositionX(), pGo->GetPositionY(),pGo->GetPositionZ(), 0, 1)) + { + //visual effects are not working! ¬¬ + trigger->CastSpell(trigger,11542,true); + trigger->CastSpell(trigger,35470,true); + } + pGo->RemoveFromWorld(); + //pGo->CastSpell(me,12158); makes all die?! + } + } } - } - } - - void WaypointReached(uint32 uiPoint) - { - //just in case - if (GetPlayerForEscort()) - if (me->getFaction() != GetPlayerForEscort()->getFaction()) - me->setFaction(GetPlayerForEscort()->getFaction()); - switch(uiPoint) - { - case 3: - SetEscortPaused(true); - NextStep(2000,false,3); - break; - case 7: - SetEscortPaused(true); - NextStep(2000,false,4); - break; - case 9: - NextStep(1000,false,8); - break; - case 10: - NextStep(25000,false,10); - break; - case 11: - SetEscortPaused(true); - SetInFace(true); - NextStep(1000,false,11); - break; - case 12: - NextStep(25000,false,18); - break; - case 13: - Summon(7); - NextStep(25000,false,19); - break; - case 14: - SetInFace(false); - DoScriptText(SAY_BLASTMASTER_26,me); - SetEscortPaused(true); - NextStep(5000,false,20); - break; + if (bBool) + { + if (pInstance) + if (GameObject* pGo = GameObject::GetGameObject((*me),pInstance->GetData64(DATA_GO_CAVE_IN_RIGHT))) + pInstance->HandleGameObject(NULL,false,pGo); + }else + if (pInstance) + if (GameObject* pGo = GameObject::GetGameObject((*me),pInstance->GetData64(DATA_GO_CAVE_IN_LEFT))) + pInstance->HandleGameObject(NULL,false,pGo); } - } - void SetData(uint32 uiI,uint32 uiValue) - { - switch(uiI) + void SetInFace(bool bBool) { - case 1: - SetEscortPaused(true); - DoScriptText(SAY_BLASTMASTER_0,me); - NextStep(1500,true); - break; - case 2: - if (!pInstance) - return; - - switch(uiValue) - { - case 1: - pInstance->SetData(TYPE_EVENT, IN_PROGRESS); - break; - case 2: - pInstance->SetData(TYPE_EVENT, DONE); - NextStep(5000,false,22); - break; - } - break; + if (!pInstance) + return; + + if (bBool) + { + if (GameObject* pGo = GameObject::GetGameObject((*me),pInstance->GetData64(DATA_GO_CAVE_IN_RIGHT))) + me->SetFacingToObject(pGo); + }else + if (GameObject* pGo = GameObject::GetGameObject((*me),pInstance->GetData64(DATA_GO_CAVE_IN_LEFT))) + me->SetFacingToObject(pGo); } - } - void Summon(uint8 uiCase) - { - switch(uiCase) + void RestoreAll() { - case 1: - me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[0], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); - me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[1], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); - me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[2], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); - me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[3], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); - me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[4], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); - me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[5], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); - me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[6], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); - me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[7], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); - me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[8], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); - me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[9], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); - break; - case 2: - if (GameObject* pGo = me->SummonGameObject(183410, -533.140,-105.322,-156.016, 0, 0, 0, 0, 0, 1000)) - { - GoSummonList.push_back(pGo->GetGUID()); - pGo->SetFlag(GAMEOBJECT_FLAGS,GO_FLAG_UNK1); //We can't use it! - } - Summon(3); - break; - case 3: - me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[0], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); - me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[1], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); - me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[2], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); - me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[3], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); - DoScriptText(SAY_BLASTMASTER_19,me); - break; - case 4: - if (GameObject* pGo = me->SummonGameObject(183410, -542.199,-96.854,-155.790, 0, 0, 0, 0, 0, 1000)) - { - GoSummonList.push_back(pGo->GetGUID()); - pGo->SetFlag(GAMEOBJECT_FLAGS,GO_FLAG_UNK1); - } - break; - case 5: - me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[0], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); - me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[1], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); - me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[2], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); - DoScriptText(SAY_BLASTMASTER_15,me); - break; - case 6: - me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[10], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); - me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[11], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); - me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[12], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); - me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[13], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); - me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[14], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); - break; - case 7: - if (GameObject* pGo = me->SummonGameObject(183410, -507.820,-103.333,-151.353, 0, 0, 0, 0, 0, 1000)) + if (!pInstance) + return; + + if (GameObject* pGo = GameObject::GetGameObject((*me),pInstance->GetData64(DATA_GO_CAVE_IN_RIGHT))) + pInstance->HandleGameObject(NULL,false,pGo); + + if (GameObject* pGo = GameObject::GetGameObject((*me),pInstance->GetData64(DATA_GO_CAVE_IN_LEFT))) + pInstance->HandleGameObject(NULL,false,pGo); + + if (!GoSummonList.empty()) + for (std::list<uint64>::const_iterator itr = GoSummonList.begin(); itr != GoSummonList.end(); ++itr) { - GoSummonList.push_back(pGo->GetGUID()); - pGo->SetFlag(GAMEOBJECT_FLAGS,GO_FLAG_UNK1); //We can't use it! - Summon(6); + if (GameObject* pGo = GameObject::GetGameObject(*me, *itr)) + pGo->RemoveFromWorld(); } - break; - case 8: - if (GameObject* pGo = me->SummonGameObject(183410, -511.829,-86.249,-151.431, 0, 0, 0, 0, 0, 1000)) + + if (!SummonList.empty()) + for (std::list<uint64>::const_iterator itr = SummonList.begin(); itr != SummonList.end(); ++itr) { - GoSummonList.push_back(pGo->GetGUID()); - pGo->SetFlag(GAMEOBJECT_FLAGS,GO_FLAG_UNK1); //We can't use it! + if (Creature* pSummon = Unit::GetCreature(*me, *itr)) + { + if (pSummon->isAlive()) + pSummon->DisappearAndDie(); + else + pSummon->RemoveCorpse(); + } } - break; - case 9: - if (Creature* pGrubbis = me->SummonCreature(NPC_GRUBBIS, SpawnPosition[15], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000)) - DoScriptText(SAY_GRUBBIS,pGrubbis); - me->SummonCreature(NPC_CHOMPER, SpawnPosition[16], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); - break; } - } - void UpdateEscortAI(const uint32 uiDiff) - { - if (uiPhase) + void AggroAllPlayers(Creature* pTemp) { - if (uiTimer <= uiDiff) + Map::PlayerList const &PlList = me->GetMap()->GetPlayers(); + + if (PlList.isEmpty()) + return; + + for (Map::PlayerList::const_iterator i = PlList.begin(); i != PlList.end(); ++i) { - switch(uiPhase) + if (Player* pPlayer = i->getSource()) { - case 1: - DoScriptText(SAY_BLASTMASTER_1,me); - NextStep(1500,true); - break; - case 2: - SetEscortPaused(false); - NextStep(0,false,0); - break; - case 3: - DoScriptText(SAY_BLASTMASTER_2,me); - SetEscortPaused(false); - NextStep(0,false,0); - break; - case 4: - DoScriptText(SAY_BLASTMASTER_3,me); - NextStep(3000,true); - break; - case 5: - DoScriptText(SAY_BLASTMASTER_4,me); - NextStep(3000,true); - break; - case 6: - SetInFace(true); - DoScriptText(SAY_BLASTMASTER_5,me); - Summon(1); - if (pInstance) - if (GameObject* pGo = GameObject::GetGameObject((*me),pInstance->GetData64(DATA_GO_CAVE_IN_RIGHT))) - pInstance->HandleGameObject(NULL,true,pGo); - NextStep(3000,true); - break; - case 7: - DoScriptText(SAY_BLASTMASTER_6,me); - SetEscortPaused(false); - NextStep(0,false,0); - break; - case 8: - me->HandleEmoteCommand(EMOTE_STATE_WORK); - NextStep(25000,true); - break; - case 9: - Summon(2); - NextStep(0,false); - break; - case 10: - Summon(4); - NextStep(0,false); - break; - case 11: - DoScriptText(SAY_BLASTMASTER_17,me); - NextStep(5000,true); - break; - case 12: - DoScriptText(SAY_BLASTMASTER_18,me); - NextStep(5000,true); - break; - case 13: - DoScriptText(SAY_BLASTMASTER_20,me); - CaveDestruction(true); - NextStep(8000,true); - break; - case 14: - DoScriptText(SAY_BLASTMASTER_21,me); - NextStep(8500,true); - break; - case 15: - DoScriptText(SAY_BLASTMASTER_22,me); - NextStep(2000,true); - break; - case 16: - DoScriptText(SAY_BLASTMASTER_23,me); - SetInFace(false); - if (pInstance) - if (GameObject* pGo = GameObject::GetGameObject((*me),pInstance->GetData64(DATA_GO_CAVE_IN_LEFT))) - pInstance->HandleGameObject(NULL,true,pGo); - NextStep(2000,true); - break; - case 17: - SetEscortPaused(false); - DoScriptText(SAY_BLASTMASTER_24,me); - Summon(6); - NextStep(0,false); - break; - case 18: - Summon(7); - NextStep(0,false); - break; - case 19: - SetInFace(false); - Summon(8); - DoScriptText(SAY_BLASTMASTER_25,me); - NextStep(0,false); - break; - case 20: - DoScriptText(SAY_BLASTMASTER_27,me); - NextStep(2000,true); - break; - case 21: - Summon(9); - NextStep(0,false); - break; - case 22: - CaveDestruction(false); - DoScriptText(SAY_BLASTMASTER_20,me); - NextStep(0,false); - break; + if (pPlayer->isGameMaster()) + continue; + + if (pPlayer->isAlive()) + { + pTemp->SetInCombatWith(pPlayer); + pPlayer->SetInCombatWith(pTemp); + pTemp->AddThreat(pPlayer, 0.0f); + } } - } else uiTimer -= uiDiff; + } } - if (!UpdateVictim()) - return; + void WaypointReached(uint32 uiPoint) + { + //just in case + if (GetPlayerForEscort()) + if (me->getFaction() != GetPlayerForEscort()->getFaction()) + me->setFaction(GetPlayerForEscort()->getFaction()); - DoMeleeAttackIfReady(); - } + switch(uiPoint) + { + case 3: + SetEscortPaused(true); + NextStep(2000,false,3); + break; + case 7: + SetEscortPaused(true); + NextStep(2000,false,4); + break; + case 9: + NextStep(1000,false,8); + break; + case 10: + NextStep(25000,false,10); + break; + case 11: + SetEscortPaused(true); + SetInFace(true); + NextStep(1000,false,11); + break; + case 12: + NextStep(25000,false,18); + break; + case 13: + Summon(7); + NextStep(25000,false,19); + break; + case 14: + SetInFace(false); + DoScriptText(SAY_BLASTMASTER_26,me); + SetEscortPaused(true); + NextStep(5000,false,20); + break; + } + } - void JustSummoned(Creature* pSummon) - { - SummonList.push_back(pSummon->GetGUID()); - AggroAllPlayers(pSummon); - } -}; + void SetData(uint32 uiI,uint32 uiValue) + { + switch(uiI) + { + case 1: + SetEscortPaused(true); + DoScriptText(SAY_BLASTMASTER_0,me); + NextStep(1500,true); + break; + case 2: + if (!pInstance) + return; + + switch(uiValue) + { + case 1: + pInstance->SetData(TYPE_EVENT, IN_PROGRESS); + break; + case 2: + pInstance->SetData(TYPE_EVENT, DONE); + NextStep(5000,false,22); + break; + } + break; + } + } -CreatureAI* GetAI_npc_blastmaster_emi_shortfuse(Creature* pCreature) -{ - return new npc_blastmaster_emi_shortfuseAI(pCreature); -} + void Summon(uint8 uiCase) + { + switch(uiCase) + { + case 1: + me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[0], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); + me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[1], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); + me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[2], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); + me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[3], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); + me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[4], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); + me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[5], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); + me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[6], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); + me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[7], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); + me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[8], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); + me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[9], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); + break; + case 2: + if (GameObject* pGo = me->SummonGameObject(183410, -533.140,-105.322,-156.016, 0, 0, 0, 0, 0, 1000)) + { + GoSummonList.push_back(pGo->GetGUID()); + pGo->SetFlag(GAMEOBJECT_FLAGS,GO_FLAG_UNK1); //We can't use it! + } + Summon(3); + break; + case 3: + me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[0], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); + me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[1], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); + me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[2], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); + me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[3], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); + DoScriptText(SAY_BLASTMASTER_19,me); + break; + case 4: + if (GameObject* pGo = me->SummonGameObject(183410, -542.199,-96.854,-155.790, 0, 0, 0, 0, 0, 1000)) + { + GoSummonList.push_back(pGo->GetGUID()); + pGo->SetFlag(GAMEOBJECT_FLAGS,GO_FLAG_UNK1); + } + break; + case 5: + me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[0], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); + me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[1], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); + me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[2], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); + DoScriptText(SAY_BLASTMASTER_15,me); + break; + case 6: + me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[10], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); + me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[11], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); + me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[12], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); + me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[13], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); + me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[14], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); + break; + case 7: + if (GameObject* pGo = me->SummonGameObject(183410, -507.820,-103.333,-151.353, 0, 0, 0, 0, 0, 1000)) + { + GoSummonList.push_back(pGo->GetGUID()); + pGo->SetFlag(GAMEOBJECT_FLAGS,GO_FLAG_UNK1); //We can't use it! + Summon(6); + } + break; + case 8: + if (GameObject* pGo = me->SummonGameObject(183410, -511.829,-86.249,-151.431, 0, 0, 0, 0, 0, 1000)) + { + GoSummonList.push_back(pGo->GetGUID()); + pGo->SetFlag(GAMEOBJECT_FLAGS,GO_FLAG_UNK1); //We can't use it! + } + break; + case 9: + if (Creature* pGrubbis = me->SummonCreature(NPC_GRUBBIS, SpawnPosition[15], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000)) + DoScriptText(SAY_GRUBBIS,pGrubbis); + me->SummonCreature(NPC_CHOMPER, SpawnPosition[16], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); + break; + } + } -bool GossipHello_npc_blastmaster_emi_shortfuse(Player* pPlayer, Creature* pCreature) -{ - ScriptedInstance* pInstance = pCreature->GetInstanceData(); + void UpdateEscortAI(const uint32 uiDiff) + { + if (uiPhase) + { + if (uiTimer <= uiDiff) + { + switch(uiPhase) + { + case 1: + DoScriptText(SAY_BLASTMASTER_1,me); + NextStep(1500,true); + break; + case 2: + SetEscortPaused(false); + NextStep(0,false,0); + break; + case 3: + DoScriptText(SAY_BLASTMASTER_2,me); + SetEscortPaused(false); + NextStep(0,false,0); + break; + case 4: + DoScriptText(SAY_BLASTMASTER_3,me); + NextStep(3000,true); + break; + case 5: + DoScriptText(SAY_BLASTMASTER_4,me); + NextStep(3000,true); + break; + case 6: + SetInFace(true); + DoScriptText(SAY_BLASTMASTER_5,me); + Summon(1); + if (pInstance) + if (GameObject* pGo = GameObject::GetGameObject((*me),pInstance->GetData64(DATA_GO_CAVE_IN_RIGHT))) + pInstance->HandleGameObject(NULL,true,pGo); + NextStep(3000,true); + break; + case 7: + DoScriptText(SAY_BLASTMASTER_6,me); + SetEscortPaused(false); + NextStep(0,false,0); + break; + case 8: + me->HandleEmoteCommand(EMOTE_STATE_WORK); + NextStep(25000,true); + break; + case 9: + Summon(2); + NextStep(0,false); + break; + case 10: + Summon(4); + NextStep(0,false); + break; + case 11: + DoScriptText(SAY_BLASTMASTER_17,me); + NextStep(5000,true); + break; + case 12: + DoScriptText(SAY_BLASTMASTER_18,me); + NextStep(5000,true); + break; + case 13: + DoScriptText(SAY_BLASTMASTER_20,me); + CaveDestruction(true); + NextStep(8000,true); + break; + case 14: + DoScriptText(SAY_BLASTMASTER_21,me); + NextStep(8500,true); + break; + case 15: + DoScriptText(SAY_BLASTMASTER_22,me); + NextStep(2000,true); + break; + case 16: + DoScriptText(SAY_BLASTMASTER_23,me); + SetInFace(false); + if (pInstance) + if (GameObject* pGo = GameObject::GetGameObject((*me),pInstance->GetData64(DATA_GO_CAVE_IN_LEFT))) + pInstance->HandleGameObject(NULL,true,pGo); + NextStep(2000,true); + break; + case 17: + SetEscortPaused(false); + DoScriptText(SAY_BLASTMASTER_24,me); + Summon(6); + NextStep(0,false); + break; + case 18: + Summon(7); + NextStep(0,false); + break; + case 19: + SetInFace(false); + Summon(8); + DoScriptText(SAY_BLASTMASTER_25,me); + NextStep(0,false); + break; + case 20: + DoScriptText(SAY_BLASTMASTER_27,me); + NextStep(2000,true); + break; + case 21: + Summon(9); + NextStep(0,false); + break; + case 22: + CaveDestruction(false); + DoScriptText(SAY_BLASTMASTER_20,me); + NextStep(0,false); + break; + } + } else uiTimer -= uiDiff; + } - if (pInstance && pInstance->GetData(TYPE_EVENT) == NOT_STARTED) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_START_EVENT, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + if (!UpdateVictim()) + return; - pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXT_EMI, pCreature->GetGUID()); + DoMeleeAttackIfReady(); + } - return true; -} + void JustSummoned(Creature* pSummon) + { + SummonList.push_back(pSummon->GetGUID()); + AggroAllPlayers(pSummon); + } + }; -bool GossipSelect_npc_blastmaster_emi_shortfuse(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) - { - if (npc_escortAI* pEscortAI = CAST_AI(npc_blastmaster_emi_shortfuseAI, pCreature->AI())) - pEscortAI->Start(true, false,pPlayer->GetGUID()); +}; - pCreature->setFaction(pPlayer->getFaction()); - pCreature->AI()->SetData(1,0); - pPlayer->CLOSE_GOSSIP_MENU(); - } - return true; -} -struct boss_grubbisAI : public ScriptedAI +
class boss_grubbis : public CreatureScript { - boss_grubbisAI(Creature* pCreature) : ScriptedAI(pCreature) +public: + boss_grubbis() : CreatureScript("boss_grubbis") { } + + CreatureAI* GetAI(Creature* pCreature) const { - SetDataSummoner(); + return new boss_grubbisAI(pCreature); } - void SetDataSummoner() + struct boss_grubbisAI : public ScriptedAI { - if (!me->isSummon()) - return; + boss_grubbisAI(Creature* pCreature) : ScriptedAI(pCreature) + { + SetDataSummoner(); + } - if (Unit* pSummon = CAST_SUM(me)->GetSummoner()) - CAST_CRE(pSummon)->AI()->SetData(2,1); - } + void SetDataSummoner() + { + if (!me->isSummon()) + return; - void UpdateAI(const uint32 /*diff*/) - { - if (!UpdateVictim()) - return; + if (Unit* pSummon = CAST_SUM(me)->GetSummoner()) + CAST_CRE(pSummon)->AI()->SetData(2,1); + } - DoMeleeAttackIfReady(); - } + void UpdateAI(const uint32 /*diff*/) + { + if (!UpdateVictim()) + return; - void JustDied(Unit* /*pKiller*/) - { - if (!me->isSummon()) - return; + DoMeleeAttackIfReady(); + } + + void JustDied(Unit* /*pKiller*/) + { + if (!me->isSummon()) + return; + + if (Unit* pSummon = CAST_SUM(me)->GetSummoner()) + CAST_CRE(pSummon)->AI()->SetData(2,2); + } + }; - if (Unit* pSummon = CAST_SUM(me)->GetSummoner()) - CAST_CRE(pSummon)->AI()->SetData(2,2); - } }; -CreatureAI* GetAI_boss_grubbis(Creature* pCreature) -{ - return new boss_grubbisAI(pCreature); -} void AddSC_gnomeregan() { - Script* newscript; - - newscript = new Script; - newscript->Name = "npc_blastmaster_emi_shortfuse"; - newscript->pGossipHello = &GossipHello_npc_blastmaster_emi_shortfuse; - newscript->pGossipSelect = &GossipSelect_npc_blastmaster_emi_shortfuse; - newscript->GetAI = &GetAI_npc_blastmaster_emi_shortfuse; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_grubbis"; - newscript->GetAI = &GetAI_boss_grubbis; - newscript->RegisterSelf(); + new npc_blastmaster_emi_shortfuse(); + new boss_grubbis(); } diff --git a/src/server/scripts/EasternKingdoms/Gnomeregan/instance_gnomeregan.cpp b/src/server/scripts/EasternKingdoms/Gnomeregan/instance_gnomeregan.cpp index c678fc55140..90fbd5e3451 100644 --- a/src/server/scripts/EasternKingdoms/Gnomeregan/instance_gnomeregan.cpp +++ b/src/server/scripts/EasternKingdoms/Gnomeregan/instance_gnomeregan.cpp @@ -19,122 +19,124 @@ #include "gnomeregan.h" #define MAX_ENCOUNTER 1 - -struct instance_gnomeregan : public ScriptedInstance +
class instance_gnomeregan : public InstanceMapScript { - instance_gnomeregan(Map* pMap) : ScriptedInstance(pMap) +public: + instance_gnomeregan() : InstanceMapScript("instance_gnomeregan") { } + + InstanceScript* GetInstanceData_InstanceMapScript(Map* pMap) { - Initialize(); - }; + return new instance_gnomeregan_InstanceMapScript(pMap); + } - uint32 m_auiEncounter[MAX_ENCOUNTER]; + struct instance_gnomeregan_InstanceMapScript : public InstanceScript + { + instance_gnomeregan_InstanceMapScript(Map* pMap) : InstanceScript(pMap) + { + Initialize(); + }; - uint64 uiCaveInLeftGUID; - uint64 uiCaveInRightGUID; + uint32 m_auiEncounter[MAX_ENCOUNTER]; - uint64 uiBastmasterEmiShortfuseGUID; + uint64 uiCaveInLeftGUID; + uint64 uiCaveInRightGUID; - void Initialize() - { - memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); + uint64 uiBastmasterEmiShortfuseGUID; - uiCaveInLeftGUID = 0; - uiCaveInRightGUID = 0; + void Initialize() + { + memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - uiBastmasterEmiShortfuseGUID = 0; - } + uiCaveInLeftGUID = 0; + uiCaveInRightGUID = 0; - void Load(const char* in) - { - if (!in) - { - OUT_LOAD_INST_DATA_FAIL; - return; + uiBastmasterEmiShortfuseGUID = 0; } - OUT_LOAD_INST_DATA(in); + void Load(const char* in) + { + if (!in) + { + OUT_LOAD_INST_DATA_FAIL; + return; + } - std::istringstream loadStream(in); - loadStream >> m_auiEncounter[0]; + OUT_LOAD_INST_DATA(in); - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - { - if (m_auiEncounter[i] == IN_PROGRESS) - m_auiEncounter[i] = NOT_STARTED; - } + std::istringstream loadStream(in); + loadStream >> m_auiEncounter[0]; - OUT_LOAD_INST_DATA_COMPLETE; - } + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + { + if (m_auiEncounter[i] == IN_PROGRESS) + m_auiEncounter[i] = NOT_STARTED; + } - void OnCreatureCreate(Creature* pCreature, bool /*bAdd*/) - { - switch(pCreature->GetEntry()) + OUT_LOAD_INST_DATA_COMPLETE; + } + + void OnCreatureCreate(Creature* pCreature, bool /*bAdd*/) { - case NPC_BLASTMASTER_EMI_SHORTFUSE: uiBastmasterEmiShortfuseGUID = pCreature->GetGUID(); break; + switch(pCreature->GetEntry()) + { + case NPC_BLASTMASTER_EMI_SHORTFUSE: uiBastmasterEmiShortfuseGUID = pCreature->GetGUID(); break; + } } - } - void OnGameObjectCreate(GameObject* pGo, bool /*bAdd*/) - { - switch(pGo->GetEntry()) + void OnGameObjectCreate(GameObject* pGo, bool /*bAdd*/) { - case GO_CAVE_IN_LEFT: - uiCaveInLeftGUID = pGo->GetGUID(); - if (m_auiEncounter[0] == DONE || m_auiEncounter[0] == NOT_STARTED) - HandleGameObject(NULL,false,pGo); - break; - case GO_CAVE_IN_RIGHT: - uiCaveInRightGUID = pGo->GetGUID(); - if (m_auiEncounter[0] == DONE || m_auiEncounter[0] == NOT_STARTED) - HandleGameObject(NULL,false,pGo); - break; + switch(pGo->GetEntry()) + { + case GO_CAVE_IN_LEFT: + uiCaveInLeftGUID = pGo->GetGUID(); + if (m_auiEncounter[0] == DONE || m_auiEncounter[0] == NOT_STARTED) + HandleGameObject(NULL,false,pGo); + break; + case GO_CAVE_IN_RIGHT: + uiCaveInRightGUID = pGo->GetGUID(); + if (m_auiEncounter[0] == DONE || m_auiEncounter[0] == NOT_STARTED) + HandleGameObject(NULL,false,pGo); + break; + } } - } - void SetData(uint32 uiType, uint32 uiData) - { - switch(uiType) + void SetData(uint32 uiType, uint32 uiData) { - case TYPE_EVENT: - m_auiEncounter[0] = uiData; - if (uiData == DONE) - SaveToDB(); - break; + switch(uiType) + { + case TYPE_EVENT: + m_auiEncounter[0] = uiData; + if (uiData == DONE) + SaveToDB(); + break; + } } - } - uint32 GetData(uint32 uiType, uint32 /*uiData*/) - { - switch(uiType) + uint32 GetData(uint32 uiType, uint32 /*uiData*/) { - case TYPE_EVENT: return m_auiEncounter[0]; + switch(uiType) + { + case TYPE_EVENT: return m_auiEncounter[0]; + } } - } - uint64 GetData64(uint32 uiType) - { - switch(uiType) + uint64 GetData64(uint32 uiType) { - case DATA_GO_CAVE_IN_LEFT: return uiCaveInLeftGUID; - case DATA_GO_CAVE_IN_RIGHT: return uiCaveInRightGUID; - case DATA_NPC_BASTMASTER_EMI_SHORTFUSE: return uiBastmasterEmiShortfuseGUID; + switch(uiType) + { + case DATA_GO_CAVE_IN_LEFT: return uiCaveInLeftGUID; + case DATA_GO_CAVE_IN_RIGHT: return uiCaveInRightGUID; + case DATA_NPC_BASTMASTER_EMI_SHORTFUSE: return uiBastmasterEmiShortfuseGUID; + } + + return 0; } + }; - return 0; - } }; -InstanceData* GetInstanceData_instance_gnomeregan(Map* pMap) -{ - return new instance_gnomeregan(pMap); -} void AddSC_instance_gnomeregan() { - Script* newscript; - - newscript = new Script; - newscript->Name = "instance_gnomeregan"; - newscript->GetInstanceData = &GetInstanceData_instance_gnomeregan; - newscript->RegisterSelf(); + new instance_gnomeregan(); } diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_curator.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_curator.cpp index ce6d4158fd7..519f0f00021 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_curator.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_curator.cpp @@ -42,157 +42,160 @@ EndScriptData */ #define SPELL_EVOCATION 30254 #define SPELL_ENRAGE 30403 //Arcane Infusion: Transforms Curator and adds damage. #define SPELL_BERSERK 26662 - -struct boss_curatorAI : public ScriptedAI +
class boss_curator : public CreatureScript { - boss_curatorAI(Creature *c) : ScriptedAI(c) {} - - uint32 AddTimer; - uint32 HatefulBoltTimer; - uint32 BerserkTimer; - - bool Enraged; - bool Evocating; - - void Reset() - { - AddTimer = 10000; - HatefulBoltTimer = 15000; //This time may be wrong - BerserkTimer = 720000; //12 minutes - Enraged = false; - Evocating = false; - - me->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_ARCANE, true); - } +public: + boss_curator() : CreatureScript("boss_curator") { } - void KilledUnit(Unit * /*victim*/) + CreatureAI* GetAI(Creature* pCreature) const { - DoScriptText(RAND(SAY_KILL1,SAY_KILL2), me); + return new boss_curatorAI (pCreature); } - void JustDied(Unit * /*victim*/) + struct boss_curatorAI : public ScriptedAI { - DoScriptText(SAY_DEATH, me); - } + boss_curatorAI(Creature *c) : ScriptedAI(c) {} - void EnterCombat(Unit * /*who*/) - { - DoScriptText(SAY_AGGRO, me); - } + uint32 AddTimer; + uint32 HatefulBoltTimer; + uint32 BerserkTimer; - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + bool Enraged; + bool Evocating; - //always decrease BerserkTimer - if (BerserkTimer <= diff) + void Reset() { - //if evocate, then break evocate - if (Evocating) - { - if (me->HasAura(SPELL_EVOCATION)) - me->RemoveAurasDueToSpell(SPELL_EVOCATION); + AddTimer = 10000; + HatefulBoltTimer = 15000; //This time may be wrong + BerserkTimer = 720000; //12 minutes + Enraged = false; + Evocating = false; - Evocating = false; - } - - //may not be correct SAY (generic hard enrage) - DoScriptText(SAY_ENRAGE, me); + me->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_ARCANE, true); + } - me->InterruptNonMeleeSpells(true); - DoCast(me, SPELL_BERSERK); + void KilledUnit(Unit * /*victim*/) + { + DoScriptText(RAND(SAY_KILL1,SAY_KILL2), me); + } - //don't know if he's supposed to do summon/evocate after hard enrage (probably not) - Enraged = true; - } else BerserkTimer -= diff; + void JustDied(Unit * /*victim*/) + { + DoScriptText(SAY_DEATH, me); + } - if (Evocating) + void EnterCombat(Unit * /*who*/) { - //not supposed to do anything while evocate - if (me->HasAura(SPELL_EVOCATION)) - return; - else - Evocating = false; + DoScriptText(SAY_AGGRO, me); } - if (!Enraged) + void UpdateAI(const uint32 diff) { - if (AddTimer <= diff) - { - //Summon Astral Flare - Creature* AstralFlare = DoSpawnCreature(17096, rand()%37, rand()%37, 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); - Unit *pTarget = NULL; - pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); + if (!UpdateVictim()) + return; - if (AstralFlare && pTarget) + //always decrease BerserkTimer + if (BerserkTimer <= diff) + { + //if evocate, then break evocate + if (Evocating) { - AstralFlare->CastSpell(AstralFlare, SPELL_ASTRAL_FLARE_PASSIVE, false); - AstralFlare->AI()->AttackStart(pTarget); + if (me->HasAura(SPELL_EVOCATION)) + me->RemoveAurasDueToSpell(SPELL_EVOCATION); + + Evocating = false; } - //Reduce Mana by 10% of max health - if (int32 mana = me->GetMaxPower(POWER_MANA)) + //may not be correct SAY (generic hard enrage) + DoScriptText(SAY_ENRAGE, me); + + me->InterruptNonMeleeSpells(true); + DoCast(me, SPELL_BERSERK); + + //don't know if he's supposed to do summon/evocate after hard enrage (probably not) + Enraged = true; + } else BerserkTimer -= diff; + + if (Evocating) + { + //not supposed to do anything while evocate + if (me->HasAura(SPELL_EVOCATION)) + return; + else + Evocating = false; + } + + if (!Enraged) + { + if (AddTimer <= diff) { - mana /= 10; - me->ModifyPower(POWER_MANA, -mana); + //Summon Astral Flare + Creature* AstralFlare = DoSpawnCreature(17096, rand()%37, rand()%37, 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); + Unit *pTarget = NULL; + pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); - //if this get's us below 10%, then we evocate (the 10th should be summoned now) - if (me->GetPower(POWER_MANA)*100 / me->GetMaxPower(POWER_MANA) < 10) + if (AstralFlare && pTarget) { - DoScriptText(SAY_EVOCATE, me); - me->InterruptNonMeleeSpells(false); - DoCast(me, SPELL_EVOCATION); - Evocating = true; - //no AddTimer cooldown, this will make first flare appear instantly after evocate end, like expected - return; + AstralFlare->CastSpell(AstralFlare, SPELL_ASTRAL_FLARE_PASSIVE, false); + AstralFlare->AI()->AttackStart(pTarget); } - else + + //Reduce Mana by 10% of max health + if (int32 mana = me->GetMaxPower(POWER_MANA)) { - if (urand(0,1) == 0) + mana /= 10; + me->ModifyPower(POWER_MANA, -mana); + + //if this get's us below 10%, then we evocate (the 10th should be summoned now) + if (me->GetPower(POWER_MANA)*100 / me->GetMaxPower(POWER_MANA) < 10) { - DoScriptText(RAND(SAY_SUMMON1,SAY_SUMMON2), me); + DoScriptText(SAY_EVOCATE, me); + me->InterruptNonMeleeSpells(false); + DoCast(me, SPELL_EVOCATION); + Evocating = true; + //no AddTimer cooldown, this will make first flare appear instantly after evocate end, like expected + return; + } + else + { + if (urand(0,1) == 0) + { + DoScriptText(RAND(SAY_SUMMON1,SAY_SUMMON2), me); + } } } - } - AddTimer = 10000; - } else AddTimer -= diff; + AddTimer = 10000; + } else AddTimer -= diff; - if (me->GetHealth()*100 / me->GetMaxHealth() <= 15) - { - Enraged = true; - DoCast(me, SPELL_ENRAGE); - DoScriptText(SAY_ENRAGE, me); + if (me->GetHealth()*100 / me->GetMaxHealth() <= 15) + { + Enraged = true; + DoCast(me, SPELL_ENRAGE); + DoScriptText(SAY_ENRAGE, me); + } } - } - if (HatefulBoltTimer <= diff) - { - if (Enraged) - HatefulBoltTimer = 7000; - else - HatefulBoltTimer = 15000; + if (HatefulBoltTimer <= diff) + { + if (Enraged) + HatefulBoltTimer = 7000; + else + HatefulBoltTimer = 15000; - if (Unit *pTarget = SelectUnit(SELECT_TARGET_TOPAGGRO, 1)) - DoCast(pTarget, SPELL_HATEFUL_BOLT); + if (Unit *pTarget = SelectUnit(SELECT_TARGET_TOPAGGRO, 1)) + DoCast(pTarget, SPELL_HATEFUL_BOLT); - } else HatefulBoltTimer -= diff; + } else HatefulBoltTimer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_curator(Creature* pCreature) -{ - return new boss_curatorAI (pCreature); -} void AddSC_boss_curator() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_curator"; - newscript->GetAI = &GetAI_boss_curator; - newscript->RegisterSelf(); + new boss_curator(); } diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_maiden_of_virtue.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_maiden_of_virtue.cpp index 19b6b203d4c..8a3989747e6 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_maiden_of_virtue.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_maiden_of_virtue.cpp @@ -38,103 +38,105 @@ EndScriptData */ #define SPELL_HOLYWRATH 32445 #define SPELL_HOLYGROUND 29512 #define SPELL_BERSERK 26662 - -struct boss_maiden_of_virtueAI : public ScriptedAI +
class boss_maiden_of_virtue : public CreatureScript { - boss_maiden_of_virtueAI(Creature *c) : ScriptedAI(c) {} - - uint32 Repentance_Timer; - uint32 Holyfire_Timer; - uint32 Holywrath_Timer; - uint32 Holyground_Timer; - uint32 Enrage_Timer; - - bool Enraged; - - void Reset() - { - Repentance_Timer = 25000+(rand()%15000); - Holyfire_Timer = 8000+(rand()%17000); - Holywrath_Timer = 15000+(rand()%10000); - Holyground_Timer = 3000; - Enrage_Timer = 600000; - - Enraged = false; - } +public: + boss_maiden_of_virtue() : CreatureScript("boss_maiden_of_virtue") { } - void KilledUnit(Unit* /*Victim*/) + CreatureAI* GetAI(Creature* pCreature) const { - if (urand(0,1) == 0) - DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2,SAY_SLAY3), me); + return new boss_maiden_of_virtueAI (pCreature); } - void JustDied(Unit* /*Killer*/) + struct boss_maiden_of_virtueAI : public ScriptedAI { - DoScriptText(SAY_DEATH, me); - } + boss_maiden_of_virtueAI(Creature *c) : ScriptedAI(c) {} - void EnterCombat(Unit * /*who*/) - { - DoScriptText(SAY_AGGRO, me); - } + uint32 Repentance_Timer; + uint32 Holyfire_Timer; + uint32 Holywrath_Timer; + uint32 Holyground_Timer; + uint32 Enrage_Timer; - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + bool Enraged; - if (Enrage_Timer < diff && !Enraged) + void Reset() { - DoCast(me, SPELL_BERSERK, true); - Enraged = true; - } else Enrage_Timer -= diff; + Repentance_Timer = 25000+(rand()%15000); + Holyfire_Timer = 8000+(rand()%17000); + Holywrath_Timer = 15000+(rand()%10000); + Holyground_Timer = 3000; + Enrage_Timer = 600000; + + Enraged = false; + } - if (Holyground_Timer <= diff) + void KilledUnit(Unit* /*Victim*/) { - DoCast(me, SPELL_HOLYGROUND, true); //Triggered so it doesn't interrupt her at all - Holyground_Timer = 3000; - } else Holyground_Timer -= diff; + if (urand(0,1) == 0) + DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2,SAY_SLAY3), me); + } - if (Repentance_Timer <= diff) + void JustDied(Unit* /*Killer*/) { - DoCast(me->getVictim(), SPELL_REPENTANCE); - DoScriptText(RAND(SAY_REPENTANCE1,SAY_REPENTANCE2), me); + DoScriptText(SAY_DEATH, me); + } - Repentance_Timer = urand(25000,35000); //A little randomness on that spell - } else Repentance_Timer -= diff; + void EnterCombat(Unit * /*who*/) + { + DoScriptText(SAY_AGGRO, me); + } - if (Holyfire_Timer <= diff) + void UpdateAI(const uint32 diff) { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(pTarget, SPELL_HOLYFIRE); + if (!UpdateVictim()) + return; - Holyfire_Timer = urand(8000,23000); //Anywhere from 8 to 23 seconds, good luck having several of those in a row! - } else Holyfire_Timer -= diff; + if (Enrage_Timer < diff && !Enraged) + { + DoCast(me, SPELL_BERSERK, true); + Enraged = true; + } else Enrage_Timer -= diff; - if (Holywrath_Timer <= diff) - { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(pTarget, SPELL_HOLYWRATH); + if (Holyground_Timer <= diff) + { + DoCast(me, SPELL_HOLYGROUND, true); //Triggered so it doesn't interrupt her at all + Holyground_Timer = 3000; + } else Holyground_Timer -= diff; - Holywrath_Timer = urand(20000,25000); //20-30 secs sounds nice - } else Holywrath_Timer -= diff; + if (Repentance_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_REPENTANCE); + DoScriptText(RAND(SAY_REPENTANCE1,SAY_REPENTANCE2), me); - DoMeleeAttackIfReady(); - } + Repentance_Timer = urand(25000,35000); //A little randomness on that spell + } else Repentance_Timer -= diff; + + if (Holyfire_Timer <= diff) + { + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + DoCast(pTarget, SPELL_HOLYFIRE); + + Holyfire_Timer = urand(8000,23000); //Anywhere from 8 to 23 seconds, good luck having several of those in a row! + } else Holyfire_Timer -= diff; + + if (Holywrath_Timer <= diff) + { + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + DoCast(pTarget, SPELL_HOLYWRATH); + + Holywrath_Timer = urand(20000,25000); //20-30 secs sounds nice + } else Holywrath_Timer -= diff; + + DoMeleeAttackIfReady(); + } + + }; }; -CreatureAI* GetAI_boss_maiden_of_virtue(Creature* pCreature) -{ - return new boss_maiden_of_virtueAI (pCreature); -} void AddSC_boss_maiden_of_virtue() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_maiden_of_virtue"; - newscript->GetAI = &GetAI_boss_maiden_of_virtue; - newscript->RegisterSelf(); + new boss_maiden_of_virtue(); } - diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp index 939a5a1684a..603e2bfb65c 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp @@ -45,268 +45,271 @@ EndScriptData */ //Attumen (TODO: Use the summoning spell instead of Creature id. It works , but is not convenient for us) #define SUMMON_ATTUMEN 15550 - -struct boss_midnightAI : public ScriptedAI +
class boss_attumen : public CreatureScript { - boss_midnightAI(Creature *c) : ScriptedAI(c) {} - - uint64 Attumen; - uint8 Phase; - uint32 Mount_Timer; +public: + boss_attumen() : CreatureScript("boss_attumen") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - Phase = 1; - Attumen = 0; - Mount_Timer = 0; - - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->SetVisibility(VISIBILITY_ON); + return new boss_attumenAI (pCreature); } - void EnterCombat(Unit* /*who*/) {} - - void KilledUnit(Unit * /*victim*/) + struct boss_attumenAI : public ScriptedAI { - if (Phase == 2) + boss_attumenAI(Creature *c) : ScriptedAI(c) { - if (Unit *pUnit = Unit::GetUnit(*me, Attumen)) - DoScriptText(SAY_MIDNIGHT_KILL, pUnit); + Phase = 1; + + CleaveTimer = urand(10000,15000); + CurseTimer = 30000; + RandomYellTimer = urand(30000,60000); //Occasionally yell + ChargeTimer = 20000; + ResetTimer = 0; } - } - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + uint64 Midnight; + uint8 Phase; + uint32 CleaveTimer; + uint32 CurseTimer; + uint32 RandomYellTimer; + uint32 ChargeTimer; //only when mounted + uint32 ResetTimer; - if (Phase == 1 && (me->GetHealth()*100)/me->GetMaxHealth() < 95) + void Reset() { - Phase = 2; - if (Creature* pAttumen = me->SummonCreature(SUMMON_ATTUMEN, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 30000)) - { - Attumen = pAttumen->GetGUID(); - pAttumen->AI()->AttackStart(me->getVictim()); - SetMidnight(pAttumen, me->GetGUID()); - DoScriptText(RAND(SAY_APPEAR1,SAY_APPEAR2,SAY_APPEAR3), pAttumen); - } + ResetTimer = 2000; } - else if (Phase == 2 && (me->GetHealth()*100)/me->GetMaxHealth() < 25) + + void EnterCombat(Unit* /*who*/) {} + + void KilledUnit(Unit * /*victim*/) { - if (Unit *pAttumen = Unit::GetUnit(*me, Attumen)) - Mount(pAttumen); + DoScriptText(RAND(SAY_KILL1,SAY_KILL2), me); } - else if (Phase == 3) + + void JustDied(Unit * /*victim*/) { - if (Mount_Timer) - { - if (Mount_Timer <= diff) - { - Mount_Timer = 0; - me->SetVisibility(VISIBILITY_OFF); - me->GetMotionMaster()->MoveIdle(); - if (Unit *pAttumen = Unit::GetUnit(*me, Attumen)) - { - pAttumen->SetDisplayId(MOUNTED_DISPLAYID); - pAttumen->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - if (pAttumen->getVictim()) - { - pAttumen->GetMotionMaster()->MoveChase(pAttumen->getVictim()); - pAttumen->SetUInt64Value(UNIT_FIELD_TARGET, pAttumen->getVictim()->GetGUID()); - } - pAttumen->SetFloatValue(OBJECT_FIELD_SCALE_X,1); - } - } else Mount_Timer -= diff; - } + DoScriptText(SAY_DEATH, me); + if (Unit *pMidnight = Unit::GetUnit(*me, Midnight)) + pMidnight->Kill(pMidnight); } - if (Phase != 3) - DoMeleeAttackIfReady(); - } + void UpdateAI(const uint32 diff); - void Mount(Unit *pAttumen) - { - DoScriptText(SAY_MOUNT, pAttumen); - Phase = 3; - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - pAttumen->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - float angle = me->GetAngle(pAttumen); - float distance = me->GetDistance2d(pAttumen); - float newX = me->GetPositionX() + cos(angle)*(distance/2) ; - float newY = me->GetPositionY() + sin(angle)*(distance/2) ; - float newZ = 50; - //me->Relocate(newX,newY,newZ,angle); - //me->SendMonsterMove(newX, newY, newZ, 0, true, 1000); - me->GetMotionMaster()->Clear(); - me->GetMotionMaster()->MovePoint(0, newX, newY, newZ); - distance += 10; - newX = me->GetPositionX() + cos(angle)*(distance/2) ; - newY = me->GetPositionY() + sin(angle)*(distance/2) ; - pAttumen->GetMotionMaster()->Clear(); - pAttumen->GetMotionMaster()->MovePoint(0, newX, newY, newZ); - //pAttumen->Relocate(newX,newY,newZ,-angle); - //pAttumen->SendMonsterMove(newX, newY, newZ, 0, true, 1000); - Mount_Timer = 1000; - } + void SpellHit(Unit * /*source*/, const SpellEntry *spell) + { + if (spell->Mechanic == MECHANIC_DISARM) + DoScriptText(SAY_DISARMED, me); + } + }; - void SetMidnight(Creature *, uint64); //Below .. }; - -CreatureAI* GetAI_boss_midnight(Creature* pCreature) +
class boss_midnight : public CreatureScript { - return new boss_midnightAI(pCreature); -} +public: + boss_midnight() : CreatureScript("boss_midnight") { } -struct boss_attumenAI : public ScriptedAI -{ - boss_attumenAI(Creature *c) : ScriptedAI(c) + CreatureAI* GetAI(Creature* pCreature) const { - Phase = 1; - - CleaveTimer = urand(10000,15000); - CurseTimer = 30000; - RandomYellTimer = urand(30000,60000); //Occasionally yell - ChargeTimer = 20000; - ResetTimer = 0; + return new boss_midnightAI(pCreature); } - uint64 Midnight; - uint8 Phase; - uint32 CleaveTimer; - uint32 CurseTimer; - uint32 RandomYellTimer; - uint32 ChargeTimer; //only when mounted - uint32 ResetTimer; - - void Reset() + struct boss_midnightAI : public ScriptedAI { - ResetTimer = 2000; - } + boss_midnightAI(Creature *c) : ScriptedAI(c) {} - void EnterCombat(Unit* /*who*/) {} + uint64 Attumen; + uint8 Phase; + uint32 Mount_Timer; - void KilledUnit(Unit * /*victim*/) - { - DoScriptText(RAND(SAY_KILL1,SAY_KILL2), me); - } + void Reset() + { + Phase = 1; + Attumen = 0; + Mount_Timer = 0; - void JustDied(Unit * /*victim*/) - { - DoScriptText(SAY_DEATH, me); - if (Unit *pMidnight = Unit::GetUnit(*me, Midnight)) - pMidnight->Kill(pMidnight); - } + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->SetVisibility(VISIBILITY_ON); + } - void UpdateAI(const uint32 diff) - { - if (ResetTimer) + void EnterCombat(Unit* /*who*/) {} + + void KilledUnit(Unit * /*victim*/) { - if (ResetTimer <= diff) + if (Phase == 2) + { + if (Unit *pUnit = Unit::GetUnit(*me, Attumen)) + DoScriptText(SAY_MIDNIGHT_KILL, pUnit); + } + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if (Phase == 1 && (me->GetHealth()*100)/me->GetMaxHealth() < 95) { - ResetTimer = 0; - Unit *pMidnight = Unit::GetUnit(*me, Midnight); - if (pMidnight) + Phase = 2; + if (Creature* pAttumen = me->SummonCreature(SUMMON_ATTUMEN, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 30000)) { - pMidnight->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - pMidnight->SetVisibility(VISIBILITY_ON); + Attumen = pAttumen->GetGUID(); + pAttumen->AI()->AttackStart(me->getVictim()); + SetMidnight(pAttumen, me->GetGUID()); + DoScriptText(RAND(SAY_APPEAR1,SAY_APPEAR2,SAY_APPEAR3), pAttumen); + } + } + else if (Phase == 2 && (me->GetHealth()*100)/me->GetMaxHealth() < 25) + { + if (Unit *pAttumen = Unit::GetUnit(*me, Attumen)) + Mount(pAttumen); + } + else if (Phase == 3) + { + if (Mount_Timer) + { + if (Mount_Timer <= diff) + { + Mount_Timer = 0; + me->SetVisibility(VISIBILITY_OFF); + me->GetMotionMaster()->MoveIdle(); + if (Unit *pAttumen = Unit::GetUnit(*me, Attumen)) + { + pAttumen->SetDisplayId(MOUNTED_DISPLAYID); + pAttumen->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + if (pAttumen->getVictim()) + { + pAttumen->GetMotionMaster()->MoveChase(pAttumen->getVictim()); + pAttumen->SetUInt64Value(UNIT_FIELD_TARGET, pAttumen->getVictim()->GetGUID()); + } + pAttumen->SetFloatValue(OBJECT_FIELD_SCALE_X,1); + } + } else Mount_Timer -= diff; } - Midnight = 0; - me->SetVisibility(VISIBILITY_OFF); - me->Kill(me); } - } else ResetTimer -= diff; - - //Return since we have no target - if (!UpdateVictim()) - return; - if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE)) - return; + if (Phase != 3) + DoMeleeAttackIfReady(); + } - if (CleaveTimer <= diff) + void Mount(Unit *pAttumen) { - DoCast(me->getVictim(), SPELL_SHADOWCLEAVE); - CleaveTimer = urand(10000,15000); - } else CleaveTimer -= diff; + DoScriptText(SAY_MOUNT, pAttumen); + Phase = 3; + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + pAttumen->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + float angle = me->GetAngle(pAttumen); + float distance = me->GetDistance2d(pAttumen); + float newX = me->GetPositionX() + cos(angle)*(distance/2) ; + float newY = me->GetPositionY() + sin(angle)*(distance/2) ; + float newZ = 50; + //me->Relocate(newX,newY,newZ,angle); + //me->SendMonsterMove(newX, newY, newZ, 0, true, 1000); + me->GetMotionMaster()->Clear(); + me->GetMotionMaster()->MovePoint(0, newX, newY, newZ); + distance += 10; + newX = me->GetPositionX() + cos(angle)*(distance/2) ; + newY = me->GetPositionY() + sin(angle)*(distance/2) ; + pAttumen->GetMotionMaster()->Clear(); + pAttumen->GetMotionMaster()->MovePoint(0, newX, newY, newZ); + //pAttumen->Relocate(newX,newY,newZ,-angle); + //pAttumen->SendMonsterMove(newX, newY, newZ, 0, true, 1000); + Mount_Timer = 1000; + } - if (CurseTimer <= diff) + void SetMidnight(Creature *pAttumen, uint64 value) { - DoCast(me->getVictim(), SPELL_INTANGIBLE_PRESENCE); - CurseTimer = 30000; - } else CurseTimer -= diff; + CAST_AI(boss_attumen::boss_attumenAI, pAttumen->AI())->Midnight = value; + }
}; - if (RandomYellTimer <= diff) - { - DoScriptText(RAND(SAY_RANDOM1,SAY_RANDOM2), me); - RandomYellTimer = urand(30000,60000); - } else RandomYellTimer -= diff; +}; - if (me->GetUInt32Value(UNIT_FIELD_DISPLAYID) == MOUNTED_DISPLAYID) +void boss_attumen::boss_attumenAI::UpdateAI(const uint32 diff) +{ + if (ResetTimer) + { + if (ResetTimer <= diff) { - if (ChargeTimer <= diff) + ResetTimer = 0; + Unit *pMidnight = Unit::GetUnit(*me, Midnight); + if (pMidnight) { - Unit *pTarget = NULL; - std::list<HostileReference *> t_list = me->getThreatManager().getThreatList(); - std::vector<Unit *> target_list; - for (std::list<HostileReference *>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) - { - pTarget = Unit::GetUnit(*me, (*itr)->getUnitGuid()); - if (pTarget && !pTarget->IsWithinDist(me, ATTACK_DISTANCE, false)) - target_list.push_back(pTarget); - pTarget = NULL; - } - if (target_list.size()) - pTarget = *(target_list.begin()+rand()%target_list.size()); - - DoCast(pTarget, SPELL_BERSERKER_CHARGE); - ChargeTimer = 20000; - } else ChargeTimer -= diff; + pMidnight->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + pMidnight->SetVisibility(VISIBILITY_ON); + } + Midnight = 0; + me->SetVisibility(VISIBILITY_OFF); + me->Kill(me); } - else + } else ResetTimer -= diff; + + //Return since we have no target + if (!UpdateVictim()) + return; + + if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE)) + return; + + if (CleaveTimer <= diff) + { + DoCast(me->getVictim(), SPELL_SHADOWCLEAVE); + CleaveTimer = urand(10000,15000); + } else CleaveTimer -= diff; + + if (CurseTimer <= diff) + { + DoCast(me->getVictim(), SPELL_INTANGIBLE_PRESENCE); + CurseTimer = 30000; + } else CurseTimer -= diff; + + if (RandomYellTimer <= diff) + { + DoScriptText(RAND(SAY_RANDOM1,SAY_RANDOM2), me); + RandomYellTimer = urand(30000,60000); + } else RandomYellTimer -= diff; + + if (me->GetUInt32Value(UNIT_FIELD_DISPLAYID) == MOUNTED_DISPLAYID) + { + if (ChargeTimer <= diff) { - if ((me->GetHealth()*100)/me->GetMaxHealth() < 25) + Unit *pTarget = NULL; + std::list<HostileReference *> t_list = me->getThreatManager().getThreatList(); + std::vector<Unit *> target_list; + for (std::list<HostileReference *>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) { - Creature *pMidnight = Unit::GetCreature(*me, Midnight); - if (pMidnight && pMidnight->GetTypeId() == TYPEID_UNIT) - { - CAST_AI(boss_midnightAI, (pMidnight->AI()))->Mount(me); - me->SetHealth(pMidnight->GetHealth()); - DoResetThreat(); - } + pTarget = Unit::GetUnit(*me, (*itr)->getUnitGuid()); + if (pTarget && !pTarget->IsWithinDist(me, ATTACK_DISTANCE, false)) + target_list.push_back(pTarget); + pTarget = NULL; } - } + if (target_list.size()) + pTarget = *(target_list.begin()+rand()%target_list.size()); - DoMeleeAttackIfReady(); + DoCast(pTarget, SPELL_BERSERKER_CHARGE); + ChargeTimer = 20000; + } else ChargeTimer -= diff; } - - void SpellHit(Unit * /*source*/, const SpellEntry *spell) + else { - if (spell->Mechanic == MECHANIC_DISARM) - DoScriptText(SAY_DISARMED, me); + if ((me->GetHealth()*100)/me->GetMaxHealth() < 25) + { + Creature *pMidnight = Unit::GetCreature(*me, Midnight); + if (pMidnight && pMidnight->GetTypeId() == TYPEID_UNIT) + { + CAST_AI(boss_midnight::boss_midnightAI, (pMidnight->AI()))->Mount(me); + me->SetHealth(pMidnight->GetHealth()); + DoResetThreat(); + } + } } -}; -void boss_midnightAI::SetMidnight(Creature *pAttumen, uint64 value) -{ - CAST_AI(boss_attumenAI, pAttumen->AI())->Midnight = value; + DoMeleeAttackIfReady(); } -CreatureAI* GetAI_boss_attumen(Creature* pCreature) -{ - return new boss_attumenAI (pCreature); -} void AddSC_boss_attumen() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_attumen"; - newscript->GetAI = &GetAI_boss_attumen; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_midnight"; - newscript->GetAI = &GetAI_boss_midnight; - newscript->RegisterSelf(); + new boss_attumen(); + new boss_midnight(); } - diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp index fc46d027d07..4c3606cd7e1 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp @@ -59,254 +59,265 @@ const uint32 Adds[6]= 19875, 19876, }; - -struct boss_moroesAI : public ScriptedAI +
class boss_moroes : public CreatureScript { - boss_moroesAI(Creature *c) : ScriptedAI(c) +public: + boss_moroes() : CreatureScript("boss_moroes") { } + + CreatureAI* GetAI(Creature* pCreature) const { - for (uint8 i = 0; i < 4; ++i) + return new boss_moroesAI (pCreature); + } + + struct boss_moroesAI : public ScriptedAI + { + boss_moroesAI(Creature *c) : ScriptedAI(c) { - AddId[i] = 0; + for (uint8 i = 0; i < 4; ++i) + { + AddId[i] = 0; + } + pInstance = c->GetInstanceScript(); } - pInstance = c->GetInstanceData(); - } - ScriptedInstance *pInstance; + InstanceScript *pInstance; - uint64 AddGUID[4]; + uint64 AddGUID[4]; - uint32 Vanish_Timer; - uint32 Blind_Timer; - uint32 Gouge_Timer; - uint32 Wait_Timer; - uint32 CheckAdds_Timer; - uint32 AddId[4]; + uint32 Vanish_Timer; + uint32 Blind_Timer; + uint32 Gouge_Timer; + uint32 Wait_Timer; + uint32 CheckAdds_Timer; + uint32 AddId[4]; - bool InVanish; - bool Enrage; + bool InVanish; + bool Enrage; - void Reset() - { - Vanish_Timer = 30000; - Blind_Timer = 35000; - Gouge_Timer = 23000; - Wait_Timer = 0; - CheckAdds_Timer = 5000; - - Enrage = false; - InVanish = false; - if (me->GetHealth() > 0) + void Reset() { - SpawnAdds(); - } + Vanish_Timer = 30000; + Blind_Timer = 35000; + Gouge_Timer = 23000; + Wait_Timer = 0; + CheckAdds_Timer = 5000; - if (pInstance) - pInstance->SetData(TYPE_MOROES, NOT_STARTED); - } + Enrage = false; + InVanish = false; + if (me->GetHealth() > 0) + { + SpawnAdds(); + } - void StartEvent() - { - if (pInstance) - pInstance->SetData(TYPE_MOROES, IN_PROGRESS); + if (pInstance) + pInstance->SetData(TYPE_MOROES, NOT_STARTED); + } - DoZoneInCombat(); - } + void StartEvent() + { + if (pInstance) + pInstance->SetData(TYPE_MOROES, IN_PROGRESS); - void EnterCombat(Unit* /*who*/) - { - StartEvent(); + DoZoneInCombat(); + } - DoScriptText(SAY_AGGRO, me); - AddsAttack(); - DoZoneInCombat(); - } + void EnterCombat(Unit* /*who*/) + { + StartEvent(); - void KilledUnit(Unit* /*victim*/) - { - DoScriptText(RAND(SAY_KILL_1,SAY_KILL_2,SAY_KILL_3), me); - } + DoScriptText(SAY_AGGRO, me); + AddsAttack(); + DoZoneInCombat(); + } - void JustDied(Unit* /*victim*/) - { - DoScriptText(SAY_DEATH, me); + void KilledUnit(Unit* /*victim*/) + { + DoScriptText(RAND(SAY_KILL_1,SAY_KILL_2,SAY_KILL_3), me); + } - if (pInstance) - pInstance->SetData(TYPE_MOROES, DONE); + void JustDied(Unit* /*victim*/) + { + DoScriptText(SAY_DEATH, me); - DeSpawnAdds(); + if (pInstance) + pInstance->SetData(TYPE_MOROES, DONE); - //remove aura from spell Garrote when Moroes dies - if (pInstance) - pInstance->DoRemoveAurasDueToSpellOnPlayers(SPELL_GARROTE); - } + DeSpawnAdds(); - void SpawnAdds() - { - DeSpawnAdds(); - if (isAddlistEmpty()) + //remove aura from spell Garrote when Moroes dies + if (pInstance) + pInstance->DoRemoveAurasDueToSpellOnPlayers(SPELL_GARROTE); + } + + void SpawnAdds() { - Creature *pCreature = NULL; - std::vector<uint32> AddList; + DeSpawnAdds(); + if (isAddlistEmpty()) + { + Creature *pCreature = NULL; + std::vector<uint32> AddList; - for (uint8 i = 0; i < 6; ++i) - AddList.push_back(Adds[i]); + for (uint8 i = 0; i < 6; ++i) + AddList.push_back(Adds[i]); - while (AddList.size() > 4) - AddList.erase((AddList.begin())+(rand()%AddList.size())); + while (AddList.size() > 4) + AddList.erase((AddList.begin())+(rand()%AddList.size())); - uint8 i = 0; - for (std::vector<uint32>::const_iterator itr = AddList.begin(); itr != AddList.end(); ++itr) - { - uint32 entry = *itr; - - pCreature = me->SummonCreature(entry, Locations[i][0], Locations[i][1], POS_Z, Locations[i][2], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000); - if (pCreature) + uint8 i = 0; + for (std::vector<uint32>::const_iterator itr = AddList.begin(); itr != AddList.end(); ++itr) { - AddGUID[i] = pCreature->GetGUID(); - AddId[i] = entry; + uint32 entry = *itr; + + pCreature = me->SummonCreature(entry, Locations[i][0], Locations[i][1], POS_Z, Locations[i][2], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000); + if (pCreature) + { + AddGUID[i] = pCreature->GetGUID(); + AddId[i] = entry; + } + ++i; } - ++i; - } - }else - { - for (uint8 i = 0; i < 4; ++i) + }else { - Creature *pCreature = me->SummonCreature(AddId[i], Locations[i][0], Locations[i][1], POS_Z, Locations[i][2], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000); - if (pCreature) + for (uint8 i = 0; i < 4; ++i) { - AddGUID[i] = pCreature->GetGUID(); + Creature *pCreature = me->SummonCreature(AddId[i], Locations[i][0], Locations[i][1], POS_Z, Locations[i][2], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000); + if (pCreature) + { + AddGUID[i] = pCreature->GetGUID(); + } } } } - } - - bool isAddlistEmpty() - { - for (uint8 i = 0; i < 4; ++i) - { - if (AddId[i] == 0) - return true; - } - return false; - } - void DeSpawnAdds() - { - for (uint8 i = 0; i < 4 ; ++i) + bool isAddlistEmpty() { - Creature* Temp = NULL; - if (AddGUID[i]) + for (uint8 i = 0; i < 4; ++i) { - Temp = Creature::GetCreature((*me),AddGUID[i]); - if (Temp && Temp->isAlive()) - Temp->DisappearAndDie(); + if (AddId[i] == 0) + return true; } + return false; } - } - void AddsAttack() - { - for (uint8 i = 0; i < 4; ++i) + void DeSpawnAdds() { - Creature* Temp = NULL; - if (AddGUID[i]) + for (uint8 i = 0; i < 4 ; ++i) { - Temp = Creature::GetCreature((*me),AddGUID[i]); - if (Temp && Temp->isAlive()) + Creature* Temp = NULL; + if (AddGUID[i]) { - Temp->AI()->AttackStart(me->getVictim()); - DoZoneInCombat(Temp); - } else - EnterEvadeMode(); + Temp = Creature::GetCreature((*me),AddGUID[i]); + if (Temp && Temp->isAlive()) + Temp->DisappearAndDie(); + } } } - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - if (pInstance && !pInstance->GetData(TYPE_MOROES)) - { - EnterEvadeMode(); - return; - } - - if (!Enrage && me->GetHealth()*100 / me->GetMaxHealth() < 30) - { - DoCast(me, SPELL_FRENZY); - Enrage = true; - } - - if (CheckAdds_Timer <= diff) + void AddsAttack() { for (uint8 i = 0; i < 4; ++i) { Creature* Temp = NULL; if (AddGUID[i]) { - Temp = Unit::GetCreature((*me),AddGUID[i]); + Temp = Creature::GetCreature((*me),AddGUID[i]); if (Temp && Temp->isAlive()) - if (!Temp->getVictim()) - Temp->AI()->AttackStart(me->getVictim()); + { + Temp->AI()->AttackStart(me->getVictim()); + DoZoneInCombat(Temp); + } else + EnterEvadeMode(); } } - CheckAdds_Timer = 5000; - } else CheckAdds_Timer -= diff; + } - if (!Enrage) + void UpdateAI(const uint32 diff) { - //Cast Vanish, then Garrote random victim - if (Vanish_Timer <= diff) + if (!UpdateVictim()) + return; + + if (pInstance && !pInstance->GetData(TYPE_MOROES)) { - DoCast(me, SPELL_VANISH); - InVanish = true; - Vanish_Timer = 30000; - Wait_Timer = 5000; - } else Vanish_Timer -= diff; + EnterEvadeMode(); + return; + } - if (Gouge_Timer <= diff) + if (!Enrage && me->GetHealth()*100 / me->GetMaxHealth() < 30) { - DoCastVictim(SPELL_GOUGE); - Gouge_Timer = 40000; - } else Gouge_Timer -= diff; + DoCast(me, SPELL_FRENZY); + Enrage = true; + } - if (Blind_Timer <= diff) + if (CheckAdds_Timer <= diff) { - std::list<Unit*> pTargets; - SelectTargetList(pTargets, 5, SELECT_TARGET_RANDOM, me->GetMeleeReach()*5, true); - for (std::list<Unit*>::const_iterator i = pTargets.begin(); i != pTargets.end(); ++i) - if (!me->IsWithinMeleeRange(*i)) + for (uint8 i = 0; i < 4; ++i) + { + Creature* Temp = NULL; + if (AddGUID[i]) { - DoCast(*i, SPELL_BLIND); - break; + Temp = Unit::GetCreature((*me),AddGUID[i]); + if (Temp && Temp->isAlive()) + if (!Temp->getVictim()) + Temp->AI()->AttackStart(me->getVictim()); } - Blind_Timer = 40000; - } else Blind_Timer -= diff; - } + } + CheckAdds_Timer = 5000; + } else CheckAdds_Timer -= diff; - if (InVanish) - { - if (Wait_Timer <= diff) + if (!Enrage) { - DoScriptText(RAND(SAY_SPECIAL_1,SAY_SPECIAL_2), me); + //Cast Vanish, then Garrote random victim + if (Vanish_Timer <= diff) + { + DoCast(me, SPELL_VANISH); + InVanish = true; + Vanish_Timer = 30000; + Wait_Timer = 5000; + } else Vanish_Timer -= diff; - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - pTarget->CastSpell(pTarget, SPELL_GARROTE,true); + if (Gouge_Timer <= diff) + { + DoCastVictim(SPELL_GOUGE); + Gouge_Timer = 40000; + } else Gouge_Timer -= diff; + + if (Blind_Timer <= diff) + { + std::list<Unit*> pTargets; + SelectTargetList(pTargets, 5, SELECT_TARGET_RANDOM, me->GetMeleeReach()*5, true); + for (std::list<Unit*>::const_iterator i = pTargets.begin(); i != pTargets.end(); ++i) + if (!me->IsWithinMeleeRange(*i)) + { + DoCast(*i, SPELL_BLIND); + break; + } + Blind_Timer = 40000; + } else Blind_Timer -= diff; + } + + if (InVanish) + { + if (Wait_Timer <= diff) + { + DoScriptText(RAND(SAY_SPECIAL_1,SAY_SPECIAL_2), me); + + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + pTarget->CastSpell(pTarget, SPELL_GARROTE,true); - InVanish = false; - } else Wait_Timer -= diff; + InVanish = false; + } else Wait_Timer -= diff; + } + + if (!InVanish) + DoMeleeAttackIfReady(); } + }; - if (!InVanish) - DoMeleeAttackIfReady(); - } }; struct boss_moroes_guestAI : public ScriptedAI { - ScriptedInstance* pInstance; + InstanceScript* pInstance; uint64 GuestGUID[4]; @@ -315,7 +326,7 @@ struct boss_moroes_guestAI : public ScriptedAI for (uint8 i = 0; i < 4; ++i) GuestGUID[i] = 0; - pInstance = c->GetInstanceData(); + pInstance = c->GetInstanceScript(); } void Reset() @@ -335,7 +346,7 @@ struct boss_moroes_guestAI : public ScriptedAI { for (uint8 i = 0; i < 4; ++i) { - uint64 GUID = CAST_AI(boss_moroesAI, Moroes->AI())->AddGUID[i]; + uint64 GUID = CAST_AI(boss_moroes::boss_moroesAI, Moroes->AI())->AddGUID[i]; if (GUID) GuestGUID[i] = GUID; } @@ -369,419 +380,420 @@ struct boss_moroes_guestAI : public ScriptedAI #define SPELL_SWPAIN 34441 #define SPELL_SHADOWFORM 29406 -struct boss_baroness_dorothea_millstipeAI : public boss_moroes_guestAI -{ - //Shadow Priest - boss_baroness_dorothea_millstipeAI(Creature *c) : boss_moroes_guestAI(c) {} +#define SPELL_HAMMEROFJUSTICE 13005 +#define SPELL_JUDGEMENTOFCOMMAND 29386 +#define SPELL_SEALOFCOMMAND 29385 - uint32 ManaBurn_Timer; - uint32 MindFlay_Timer; - uint32 ShadowWordPain_Timer; +#define SPELL_DISPELMAGIC 15090 //Self or other guest+Moroes +#define SPELL_GREATERHEAL 29564 //Self or other guest+Moroes +#define SPELL_HOLYFIRE 29563 +#define SPELL_PWSHIELD 29408 - void Reset() - { - ManaBurn_Timer = 7000; - MindFlay_Timer = 1000; - ShadowWordPain_Timer = 6000; +#define SPELL_CLEANSE 29380 //Self or other guest+Moroes +#define SPELL_GREATERBLESSOFMIGHT 29381 //Self or other guest+Moroes +#define SPELL_HOLYLIGHT 29562 //Self or other guest+Moroes +#define SPELL_DIVINESHIELD 41367 - DoCast(me, SPELL_SHADOWFORM, true); +#define SPELL_HAMSTRING 9080 +#define SPELL_MORTALSTRIKE 29572 +#define SPELL_WHIRLWIND 29573 + +#define SPELL_DISARM 8379 +#define SPELL_HEROICSTRIKE 29567 +#define SPELL_SHIELDBASH 11972 +#define SPELL_SHIELDWALL 29390 +
class boss_baroness_dorothea_millstipe : public CreatureScript +{ +public: + boss_baroness_dorothea_millstipe() : CreatureScript("boss_baroness_dorothea_millstipe") { } - boss_moroes_guestAI::Reset(); + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_baroness_dorothea_millstipeAI (pCreature); } - void UpdateAI(const uint32 diff) + struct boss_baroness_dorothea_millstipeAI : public boss_moroes_guestAI { - if (!UpdateVictim()) - return; + //Shadow Priest + boss_baroness_dorothea_millstipeAI(Creature *c) : boss_moroes_guestAI(c) {} - boss_moroes_guestAI::UpdateAI(diff); + uint32 ManaBurn_Timer; + uint32 MindFlay_Timer; + uint32 ShadowWordPain_Timer; - if (MindFlay_Timer <= diff) + void Reset() { - DoCast(me->getVictim(), SPELL_MINDFLY); - MindFlay_Timer = 12000; // 3 sec channeled - } else MindFlay_Timer -= diff; + ManaBurn_Timer = 7000; + MindFlay_Timer = 1000; + ShadowWordPain_Timer = 6000; - if (ManaBurn_Timer <= diff) - { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - if (pTarget->getPowerType() == POWER_MANA) - DoCast(pTarget, SPELL_MANABURN); - ManaBurn_Timer = 5000; // 3 sec cast - } else ManaBurn_Timer -= diff; + DoCast(me, SPELL_SHADOWFORM, true); - if (ShadowWordPain_Timer <= diff) + boss_moroes_guestAI::Reset(); + } + + void UpdateAI(const uint32 diff) { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + if (!UpdateVictim()) + return; + + boss_moroes_guestAI::UpdateAI(diff); + + if (MindFlay_Timer <= diff) { - DoCast(pTarget, SPELL_SWPAIN); - ShadowWordPain_Timer = 7000; - } - } else ShadowWordPain_Timer -= diff; - } -}; + DoCast(me->getVictim(), SPELL_MINDFLY); + MindFlay_Timer = 12000; // 3 sec channeled + } else MindFlay_Timer -= diff; -#define SPELL_HAMMEROFJUSTICE 13005 -#define SPELL_JUDGEMENTOFCOMMAND 29386 -#define SPELL_SEALOFCOMMAND 29385 + if (ManaBurn_Timer <= diff) + { + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + if (pTarget->getPowerType() == POWER_MANA) + DoCast(pTarget, SPELL_MANABURN); + ManaBurn_Timer = 5000; // 3 sec cast + } else ManaBurn_Timer -= diff; -struct boss_baron_rafe_dreugerAI : public boss_moroes_guestAI -{ - //Retr Pally - boss_baron_rafe_dreugerAI(Creature *c) : boss_moroes_guestAI(c){} + if (ShadowWordPain_Timer <= diff) + { + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + { + DoCast(pTarget, SPELL_SWPAIN); + ShadowWordPain_Timer = 7000; + } + } else ShadowWordPain_Timer -= diff; + } + }; - uint32 HammerOfJustice_Timer; - uint32 SealOfCommand_Timer; - uint32 JudgementOfCommand_Timer; +}; +
class boss_baron_rafe_dreuger : public CreatureScript +{ +public: + boss_baron_rafe_dreuger() : CreatureScript("boss_baron_rafe_dreuger") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - HammerOfJustice_Timer = 1000; - SealOfCommand_Timer = 7000; - JudgementOfCommand_Timer = SealOfCommand_Timer + 29000; - - boss_moroes_guestAI::Reset(); + return new boss_baron_rafe_dreugerAI (pCreature); } - void UpdateAI(const uint32 diff) + struct boss_baron_rafe_dreugerAI : public boss_moroes_guestAI { - if (!UpdateVictim()) - return; + //Retr Pally + boss_baron_rafe_dreugerAI(Creature *c) : boss_moroes_guestAI(c){} - boss_moroes_guestAI::UpdateAI(diff); + uint32 HammerOfJustice_Timer; + uint32 SealOfCommand_Timer; + uint32 JudgementOfCommand_Timer; - if (SealOfCommand_Timer <= diff) + void Reset() { - DoCast(me, SPELL_SEALOFCOMMAND); - SealOfCommand_Timer = 32000; - JudgementOfCommand_Timer = 29000; - } else SealOfCommand_Timer -= diff; - - if (JudgementOfCommand_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_JUDGEMENTOFCOMMAND); + HammerOfJustice_Timer = 1000; + SealOfCommand_Timer = 7000; JudgementOfCommand_Timer = SealOfCommand_Timer + 29000; - } else JudgementOfCommand_Timer -= diff; - if (HammerOfJustice_Timer <= diff) + boss_moroes_guestAI::Reset(); + } + + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_HAMMEROFJUSTICE); - HammerOfJustice_Timer = 12000; - } else HammerOfJustice_Timer -= diff; - } -}; + if (!UpdateVictim()) + return; -#define SPELL_DISPELMAGIC 15090 //Self or other guest+Moroes -#define SPELL_GREATERHEAL 29564 //Self or other guest+Moroes -#define SPELL_HOLYFIRE 29563 -#define SPELL_PWSHIELD 29408 + boss_moroes_guestAI::UpdateAI(diff); -struct boss_lady_catriona_von_indiAI : public boss_moroes_guestAI -{ - //Holy Priest - boss_lady_catriona_von_indiAI(Creature *c) : boss_moroes_guestAI(c) {} + if (SealOfCommand_Timer <= diff) + { + DoCast(me, SPELL_SEALOFCOMMAND); + SealOfCommand_Timer = 32000; + JudgementOfCommand_Timer = 29000; + } else SealOfCommand_Timer -= diff; - uint32 DispelMagic_Timer; - uint32 GreaterHeal_Timer; - uint32 HolyFire_Timer; - uint32 PowerWordShield_Timer; + if (JudgementOfCommand_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_JUDGEMENTOFCOMMAND); + JudgementOfCommand_Timer = SealOfCommand_Timer + 29000; + } else JudgementOfCommand_Timer -= diff; - void Reset() - { - DispelMagic_Timer = 11000; - GreaterHeal_Timer = 1500; - HolyFire_Timer = 5000; - PowerWordShield_Timer = 1000; + if (HammerOfJustice_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_HAMMEROFJUSTICE); + HammerOfJustice_Timer = 12000; + } else HammerOfJustice_Timer -= diff; + } + }; - AcquireGUID(); +}; +
class boss_lady_catriona_von_indi : public CreatureScript +{ +public: + boss_lady_catriona_von_indi() : CreatureScript("boss_lady_catriona_von_indi") { } - boss_moroes_guestAI::Reset(); + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_lady_catriona_von_indiAI (pCreature); } - void UpdateAI(const uint32 diff) + struct boss_lady_catriona_von_indiAI : public boss_moroes_guestAI { - if (!UpdateVictim()) - return; + //Holy Priest + boss_lady_catriona_von_indiAI(Creature *c) : boss_moroes_guestAI(c) {} - boss_moroes_guestAI::UpdateAI(diff); + uint32 DispelMagic_Timer; + uint32 GreaterHeal_Timer; + uint32 HolyFire_Timer; + uint32 PowerWordShield_Timer; - if (PowerWordShield_Timer <= diff) + void Reset() { - DoCast(me, SPELL_PWSHIELD); - PowerWordShield_Timer = 15000; - } else PowerWordShield_Timer -= diff; + DispelMagic_Timer = 11000; + GreaterHeal_Timer = 1500; + HolyFire_Timer = 5000; + PowerWordShield_Timer = 1000; - if (GreaterHeal_Timer <= diff) - { - Unit *pTarget = SelectGuestTarget(); + AcquireGUID(); - DoCast(pTarget, SPELL_GREATERHEAL); - GreaterHeal_Timer = 17000; - } else GreaterHeal_Timer -= diff; + boss_moroes_guestAI::Reset(); + } - if (HolyFire_Timer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_HOLYFIRE); - HolyFire_Timer = 22000; - } else HolyFire_Timer -= diff; + if (!UpdateVictim()) + return; - if (DispelMagic_Timer <= diff) - { - if (Unit *pTarget = RAND(SelectGuestTarget(), SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))) - DoCast(pTarget, SPELL_DISPELMAGIC); + boss_moroes_guestAI::UpdateAI(diff); - DispelMagic_Timer = 25000; - } else DispelMagic_Timer -= diff; - } -}; + if (PowerWordShield_Timer <= diff) + { + DoCast(me, SPELL_PWSHIELD); + PowerWordShield_Timer = 15000; + } else PowerWordShield_Timer -= diff; -#define SPELL_CLEANSE 29380 //Self or other guest+Moroes -#define SPELL_GREATERBLESSOFMIGHT 29381 //Self or other guest+Moroes -#define SPELL_HOLYLIGHT 29562 //Self or other guest+Moroes -#define SPELL_DIVINESHIELD 41367 + if (GreaterHeal_Timer <= diff) + { + Unit *pTarget = SelectGuestTarget(); -struct boss_lady_keira_berrybuckAI : public boss_moroes_guestAI -{ - //Holy Pally - boss_lady_keira_berrybuckAI(Creature *c) : boss_moroes_guestAI(c) {} + DoCast(pTarget, SPELL_GREATERHEAL); + GreaterHeal_Timer = 17000; + } else GreaterHeal_Timer -= diff; - uint32 Cleanse_Timer; - uint32 GreaterBless_Timer; - uint32 HolyLight_Timer; - uint32 DivineShield_Timer; + if (HolyFire_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_HOLYFIRE); + HolyFire_Timer = 22000; + } else HolyFire_Timer -= diff; - void Reset() - { - Cleanse_Timer = 13000; - GreaterBless_Timer = 1000; - HolyLight_Timer = 7000; - DivineShield_Timer = 31000; + if (DispelMagic_Timer <= diff) + { + if (Unit *pTarget = RAND(SelectGuestTarget(), SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))) + DoCast(pTarget, SPELL_DISPELMAGIC); + + DispelMagic_Timer = 25000; + } else DispelMagic_Timer -= diff; + } + }; - AcquireGUID(); +}; +
class boss_lady_keira_berrybuck : public CreatureScript +{ +public: + boss_lady_keira_berrybuck() : CreatureScript("boss_lady_keira_berrybuck") { } - boss_moroes_guestAI::Reset(); + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_lady_keira_berrybuckAI (pCreature); } - void UpdateAI(const uint32 diff) + struct boss_lady_keira_berrybuckAI : public boss_moroes_guestAI { - if (!UpdateVictim()) - return; + //Holy Pally + boss_lady_keira_berrybuckAI(Creature *c) : boss_moroes_guestAI(c) {} - boss_moroes_guestAI::UpdateAI(diff); + uint32 Cleanse_Timer; + uint32 GreaterBless_Timer; + uint32 HolyLight_Timer; + uint32 DivineShield_Timer; - if (DivineShield_Timer <= diff) + void Reset() { - DoCast(me, SPELL_DIVINESHIELD); + Cleanse_Timer = 13000; + GreaterBless_Timer = 1000; + HolyLight_Timer = 7000; DivineShield_Timer = 31000; - } else DivineShield_Timer -= diff; - if (HolyLight_Timer <= diff) - { - Unit *pTarget = SelectGuestTarget(); + AcquireGUID(); - DoCast(pTarget, SPELL_HOLYLIGHT); - HolyLight_Timer = 10000; - } else HolyLight_Timer -= diff; + boss_moroes_guestAI::Reset(); + } - if (GreaterBless_Timer <= diff) + void UpdateAI(const uint32 diff) { - Unit *pTarget = SelectGuestTarget(); + if (!UpdateVictim()) + return; - DoCast(pTarget, SPELL_GREATERBLESSOFMIGHT); + boss_moroes_guestAI::UpdateAI(diff); - GreaterBless_Timer = 50000; - } else GreaterBless_Timer -= diff; + if (DivineShield_Timer <= diff) + { + DoCast(me, SPELL_DIVINESHIELD); + DivineShield_Timer = 31000; + } else DivineShield_Timer -= diff; - if (Cleanse_Timer <= diff) - { - Unit *pTarget = SelectGuestTarget(); + if (HolyLight_Timer <= diff) + { + Unit *pTarget = SelectGuestTarget(); - DoCast(pTarget, SPELL_CLEANSE); + DoCast(pTarget, SPELL_HOLYLIGHT); + HolyLight_Timer = 10000; + } else HolyLight_Timer -= diff; - Cleanse_Timer = 10000; - } else Cleanse_Timer -= diff; - } -}; + if (GreaterBless_Timer <= diff) + { + Unit *pTarget = SelectGuestTarget(); -#define SPELL_HAMSTRING 9080 -#define SPELL_MORTALSTRIKE 29572 -#define SPELL_WHIRLWIND 29573 + DoCast(pTarget, SPELL_GREATERBLESSOFMIGHT); -struct boss_lord_robin_darisAI : public boss_moroes_guestAI -{ - //Arms Warr - boss_lord_robin_darisAI(Creature *c) : boss_moroes_guestAI(c) {} + GreaterBless_Timer = 50000; + } else GreaterBless_Timer -= diff; - uint32 Hamstring_Timer; - uint32 MortalStrike_Timer; - uint32 WhirlWind_Timer; + if (Cleanse_Timer <= diff) + { + Unit *pTarget = SelectGuestTarget(); - void Reset() - { - Hamstring_Timer = 7000; - MortalStrike_Timer = 10000; - WhirlWind_Timer = 21000; + DoCast(pTarget, SPELL_CLEANSE); + + Cleanse_Timer = 10000; + } else Cleanse_Timer -= diff; + } + }; + +}; +
class boss_lord_robin_daris : public CreatureScript +{ +public: + boss_lord_robin_daris() : CreatureScript("boss_lord_robin_daris") { } - boss_moroes_guestAI::Reset(); + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_lord_robin_darisAI (pCreature); } - void UpdateAI(const uint32 diff) + struct boss_lord_robin_darisAI : public boss_moroes_guestAI { - if (!UpdateVictim()) - return; + //Arms Warr + boss_lord_robin_darisAI(Creature *c) : boss_moroes_guestAI(c) {} - boss_moroes_guestAI::UpdateAI(diff); + uint32 Hamstring_Timer; + uint32 MortalStrike_Timer; + uint32 WhirlWind_Timer; - if (Hamstring_Timer <= diff) + void Reset() { - DoCast(me->getVictim(), SPELL_HAMSTRING); - Hamstring_Timer = 12000; - } else Hamstring_Timer -= diff; + Hamstring_Timer = 7000; + MortalStrike_Timer = 10000; + WhirlWind_Timer = 21000; - if (MortalStrike_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_MORTALSTRIKE); - MortalStrike_Timer = 18000; - } else MortalStrike_Timer -= diff; + boss_moroes_guestAI::Reset(); + } - if (WhirlWind_Timer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me, SPELL_WHIRLWIND); - WhirlWind_Timer = 21000; - } else WhirlWind_Timer -= diff; - } -}; + if (!UpdateVictim()) + return; -#define SPELL_DISARM 8379 -#define SPELL_HEROICSTRIKE 29567 -#define SPELL_SHIELDBASH 11972 -#define SPELL_SHIELDWALL 29390 + boss_moroes_guestAI::UpdateAI(diff); -struct boss_lord_crispin_ferenceAI : public boss_moroes_guestAI -{ - //Arms Warr - boss_lord_crispin_ferenceAI(Creature *c) : boss_moroes_guestAI(c) {} + if (Hamstring_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_HAMSTRING); + Hamstring_Timer = 12000; + } else Hamstring_Timer -= diff; - uint32 Disarm_Timer; - uint32 HeroicStrike_Timer; - uint32 ShieldBash_Timer; - uint32 ShieldWall_Timer; + if (MortalStrike_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_MORTALSTRIKE); + MortalStrike_Timer = 18000; + } else MortalStrike_Timer -= diff; - void Reset() - { - Disarm_Timer = 6000; - HeroicStrike_Timer = 10000; - ShieldBash_Timer = 8000; - ShieldWall_Timer = 4000; + if (WhirlWind_Timer <= diff) + { + DoCast(me, SPELL_WHIRLWIND); + WhirlWind_Timer = 21000; + } else WhirlWind_Timer -= diff; + } + }; - boss_moroes_guestAI::Reset(); - } +}; +
class boss_lord_crispin_ference : public CreatureScript +{ +public: + boss_lord_crispin_ference() : CreatureScript("boss_lord_crispin_ference") { } - void UpdateAI(const uint32 diff) + CreatureAI* GetAI(Creature* pCreature) const { - if (!UpdateVictim()) - return; + return new boss_lord_crispin_ferenceAI (pCreature); + } - boss_moroes_guestAI::UpdateAI(diff); + struct boss_lord_crispin_ferenceAI : public boss_moroes_guestAI + { + //Arms Warr + boss_lord_crispin_ferenceAI(Creature *c) : boss_moroes_guestAI(c) {} - if (Disarm_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_DISARM); - Disarm_Timer = 12000; - } else Disarm_Timer -= diff; + uint32 Disarm_Timer; + uint32 HeroicStrike_Timer; + uint32 ShieldBash_Timer; + uint32 ShieldWall_Timer; - if (HeroicStrike_Timer <= diff) + void Reset() { - DoCast(me->getVictim(), SPELL_HEROICSTRIKE); + Disarm_Timer = 6000; HeroicStrike_Timer = 10000; - } else HeroicStrike_Timer -= diff; + ShieldBash_Timer = 8000; + ShieldWall_Timer = 4000; - if (ShieldBash_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_SHIELDBASH); - ShieldBash_Timer = 13000; - } else ShieldBash_Timer -= diff; + boss_moroes_guestAI::Reset(); + } - if (ShieldWall_Timer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me, SPELL_SHIELDWALL); - ShieldWall_Timer = 21000; - } else ShieldWall_Timer -= diff; - } -}; - -CreatureAI* GetAI_boss_moroes(Creature* pCreature) -{ - return new boss_moroesAI (pCreature); -} + if (!UpdateVictim()) + return; -CreatureAI* GetAI_baroness_dorothea_millstipe(Creature* pCreature) -{ - return new boss_baroness_dorothea_millstipeAI (pCreature); -} + boss_moroes_guestAI::UpdateAI(diff); -CreatureAI* GetAI_baron_rafe_dreuger(Creature* pCreature) -{ - return new boss_baron_rafe_dreugerAI (pCreature); -} + if (Disarm_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_DISARM); + Disarm_Timer = 12000; + } else Disarm_Timer -= diff; -CreatureAI* GetAI_lady_catriona_von_indi(Creature* pCreature) -{ - return new boss_lady_catriona_von_indiAI (pCreature); -} + if (HeroicStrike_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_HEROICSTRIKE); + HeroicStrike_Timer = 10000; + } else HeroicStrike_Timer -= diff; -CreatureAI* GetAI_lady_keira_berrybuck(Creature* pCreature) -{ - return new boss_lady_keira_berrybuckAI (pCreature); -} + if (ShieldBash_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_SHIELDBASH); + ShieldBash_Timer = 13000; + } else ShieldBash_Timer -= diff; -CreatureAI* GetAI_lord_robin_daris(Creature* pCreature) -{ - return new boss_lord_robin_darisAI (pCreature); -} + if (ShieldWall_Timer <= diff) + { + DoCast(me, SPELL_SHIELDWALL); + ShieldWall_Timer = 21000; + } else ShieldWall_Timer -= diff; + } + }; -CreatureAI* GetAI_lord_crispin_ference(Creature* pCreature) -{ - return new boss_lord_crispin_ferenceAI (pCreature); -} +}; void AddSC_boss_moroes() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_moroes"; - newscript->GetAI = &GetAI_boss_moroes; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_baroness_dorothea_millstipe"; - newscript->GetAI = &GetAI_baroness_dorothea_millstipe; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_baron_rafe_dreuger"; - newscript->GetAI = &GetAI_baron_rafe_dreuger; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_lady_catriona_von_indi"; - newscript->GetAI = &GetAI_lady_catriona_von_indi; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_lady_keira_berrybuck"; - newscript->GetAI = &GetAI_lady_keira_berrybuck; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_lord_robin_daris"; - newscript->GetAI = &GetAI_lord_robin_daris; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_lord_crispin_ference"; - newscript->GetAI = &GetAI_lord_crispin_ference; - newscript->RegisterSelf(); + new boss_moroes(); + new boss_baroness_dorothea_millstipe(); + new boss_baron_rafe_dreuger(); + new boss_lady_catriona_von_indi(); + new boss_lady_keira_berrybuck(); + new boss_lord_robin_daris(); + new boss_lord_crispin_ference(); } - diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp index 2b287ad261f..f6088360c75 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp @@ -57,283 +57,285 @@ const uint32 PortalBeam[3] = {30465,30464,30463}; const uint32 PlayerBuff[3] = {30421,30422,30423}; const uint32 NetherBuff[3] = {30466,30467,30468}; const uint32 PlayerDebuff[3] = {38637,38638,38639}; - -struct boss_netherspiteAI : public ScriptedAI +
class boss_netherspite : public CreatureScript { - boss_netherspiteAI(Creature* c) : ScriptedAI(c) - { - pInstance = c->GetInstanceData(); - - for (int i=0; i<3; ++i) - { - PortalGUID[i] = 0; - BeamTarget[i] = 0; - BeamerGUID[i] = 0; - } - } +public: + boss_netherspite() : CreatureScript("boss_netherspite") { } - ScriptedInstance* pInstance; - - bool PortalPhase; - bool Berserk; - uint32 PhaseTimer; // timer for phase switching - uint32 VoidZoneTimer; - uint32 NetherInfusionTimer; // berserking timer - uint32 NetherbreathTimer; - uint32 EmpowermentTimer; - uint32 PortalTimer; // timer for beam checking - uint64 PortalGUID[3]; // guid's of portals - uint64 BeamerGUID[3]; // guid's of auxiliary beaming portals - uint64 BeamTarget[3]; // guid's of portals' current targets - - bool IsBetween(WorldObject* u1, WorldObject *pTarget, WorldObject* u2) // the in-line checker + CreatureAI* GetAI(Creature *pCreature) { - if (!u1 || !u2 || !pTarget) - return false; - - float xn, yn, xp, yp, xh, yh; - xn = u1->GetPositionX(); - yn = u1->GetPositionY(); - xp = u2->GetPositionX(); - yp = u2->GetPositionY(); - xh = pTarget->GetPositionX(); - yh = pTarget->GetPositionY(); - - // check if target is between (not checking distance from the beam yet) - if (dist(xn,yn,xh,yh) >= dist(xn,yn,xp,yp) || dist(xp,yp,xh,yh) >= dist(xn,yn,xp,yp)) - return false; - // check distance from the beam - return (abs((xn-xp)*yh+(yp-yn)*xh-xn*yp+xp*yn)/dist(xn,yn,xp,yp) < 1.5f); + return new boss_netherspiteAI(pCreature); } - float dist(float xa, float ya, float xb, float yb) // auxiliary method for distance + struct boss_netherspiteAI : public ScriptedAI { - return sqrt((xa-xb)*(xa-xb) + (ya-yb)*(ya-yb)); - } - - void Reset() - { - Berserk = false; - NetherInfusionTimer = 540000; - VoidZoneTimer = 15000; - NetherbreathTimer = 3000; - - HandleDoors(true); - DestroyPortals(); - } + boss_netherspiteAI(Creature* c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); - void SummonPortals() - { - uint8 r = rand()%4; - uint8 pos[3]; - pos[RED_PORTAL] = (r%2 ? (r>1 ? 2: 1): 0); - pos[GREEN_PORTAL] = (r%2 ? 0: (r>1 ? 2: 1)); - pos[BLUE_PORTAL] = (r>1 ? 1: 2); // Blue Portal not on the left side (0) - - for (int i=0; i<3; ++i) - if (Creature *portal = me->SummonCreature(PortalID[i],PortalCoord[pos[i]][0],PortalCoord[pos[i]][1],PortalCoord[pos[i]][2],0,TEMPSUMMON_TIMED_DESPAWN,60000)) + for (int i=0; i<3; ++i) { - PortalGUID[i] = portal->GetGUID(); - portal->AddAura(PortalVisual[i], portal); + PortalGUID[i] = 0; + BeamTarget[i] = 0; + BeamerGUID[i] = 0; } - } + } - void DestroyPortals() - { - for (int i=0; i<3; ++i) + InstanceScript* pInstance; + + bool PortalPhase; + bool Berserk; + uint32 PhaseTimer; // timer for phase switching + uint32 VoidZoneTimer; + uint32 NetherInfusionTimer; // berserking timer + uint32 NetherbreathTimer; + uint32 EmpowermentTimer; + uint32 PortalTimer; // timer for beam checking + uint64 PortalGUID[3]; // guid's of portals + uint64 BeamerGUID[3]; // guid's of auxiliary beaming portals + uint64 BeamTarget[3]; // guid's of portals' current targets + + bool IsBetween(WorldObject* u1, WorldObject *pTarget, WorldObject* u2) // the in-line checker { - if (Creature *portal = Unit::GetCreature(*me, PortalGUID[i])) - portal->DisappearAndDie(); - if (Creature *portal = Unit::GetCreature(*me, BeamerGUID[i])) - portal->DisappearAndDie(); - PortalGUID[i] = 0; - BeamTarget[i] = 0; + if (!u1 || !u2 || !pTarget) + return false; + + float xn, yn, xp, yp, xh, yh; + xn = u1->GetPositionX(); + yn = u1->GetPositionY(); + xp = u2->GetPositionX(); + yp = u2->GetPositionY(); + xh = pTarget->GetPositionX(); + yh = pTarget->GetPositionY(); + + // check if target is between (not checking distance from the beam yet) + if (dist(xn,yn,xh,yh) >= dist(xn,yn,xp,yp) || dist(xp,yp,xh,yh) >= dist(xn,yn,xp,yp)) + return false; + // check distance from the beam + return (abs((xn-xp)*yh+(yp-yn)*xh-xn*yp+xp*yn)/dist(xn,yn,xp,yp) < 1.5f); } - } - void UpdatePortals() // Here we handle the beams' behavior - { - for (int j=0; j<3; ++j) // j = color - if (Creature *portal = Unit::GetCreature(*me, PortalGUID[j])) - { - // the one who's been casted upon before - Unit *current = Unit::GetUnit(*portal, BeamTarget[j]); - // temporary store for the best suitable beam reciever - Unit *pTarget = me; + float dist(float xa, float ya, float xb, float yb) // auxiliary method for distance + { + return sqrt((xa-xb)*(xa-xb) + (ya-yb)*(ya-yb)); + } - if (Map* map = me->GetMap()) - { - Map::PlayerList const& players = map->GetPlayers(); + void Reset() + { + Berserk = false; + NetherInfusionTimer = 540000; + VoidZoneTimer = 15000; + NetherbreathTimer = 3000; - // get the best suitable target - for (Map::PlayerList::const_iterator i = players.begin(); i != players.end(); ++i) - { - Player* p = i->getSource(); - if (p && p->isAlive() // alive - && (!pTarget || pTarget->GetDistance2d(portal)>p->GetDistance2d(portal)) // closer than current best - && !p->HasAura(PlayerDebuff[j],0) // not exhausted - && !p->HasAura(PlayerBuff[(j+1)%3],0) // not on another beam - && !p->HasAura(PlayerBuff[(j+2)%3],0) - && IsBetween(me, p, portal)) // on the beam - pTarget = p; - } + HandleDoors(true); + DestroyPortals(); + } + + void SummonPortals() + { + uint8 r = rand()%4; + uint8 pos[3]; + pos[RED_PORTAL] = (r%2 ? (r>1 ? 2: 1): 0); + pos[GREEN_PORTAL] = (r%2 ? 0: (r>1 ? 2: 1)); + pos[BLUE_PORTAL] = (r>1 ? 1: 2); // Blue Portal not on the left side (0) + + for (int i=0; i<3; ++i) + if (Creature *portal = me->SummonCreature(PortalID[i],PortalCoord[pos[i]][0],PortalCoord[pos[i]][1],PortalCoord[pos[i]][2],0,TEMPSUMMON_TIMED_DESPAWN,60000)) + { + PortalGUID[i] = portal->GetGUID(); + portal->AddAura(PortalVisual[i], portal); } - // buff the target - if (pTarget->GetTypeId() == TYPEID_PLAYER) - pTarget->AddAura(PlayerBuff[j], pTarget); - else - pTarget->AddAura(NetherBuff[j], pTarget); - // cast visual beam on the chosen target if switched - // simple target switching isn't working -> using BeamerGUID to cast (workaround) - if (!current || pTarget != current) + } + + void DestroyPortals() + { + for (int i=0; i<3; ++i) + { + if (Creature *portal = Unit::GetCreature(*me, PortalGUID[i])) + portal->DisappearAndDie(); + if (Creature *portal = Unit::GetCreature(*me, BeamerGUID[i])) + portal->DisappearAndDie(); + PortalGUID[i] = 0; + BeamTarget[i] = 0; + } + } + + void UpdatePortals() // Here we handle the beams' behavior + { + for (int j=0; j<3; ++j) // j = color + if (Creature *portal = Unit::GetCreature(*me, PortalGUID[j])) { - BeamTarget[j] = pTarget->GetGUID(); - // remove currently beaming portal - if (Creature *beamer = Unit::GetCreature(*portal, BeamerGUID[j])) + // the one who's been casted upon before + Unit *current = Unit::GetUnit(*portal, BeamTarget[j]); + // temporary store for the best suitable beam reciever + Unit *pTarget = me; + + if (Map* map = me->GetMap()) { - beamer->CastSpell(pTarget, PortalBeam[j], false); - beamer->DisappearAndDie(); - BeamerGUID[j] = 0; + Map::PlayerList const& players = map->GetPlayers(); + + // get the best suitable target + for (Map::PlayerList::const_iterator i = players.begin(); i != players.end(); ++i) + { + Player* p = i->getSource(); + if (p && p->isAlive() // alive + && (!pTarget || pTarget->GetDistance2d(portal)>p->GetDistance2d(portal)) // closer than current best + && !p->HasAura(PlayerDebuff[j],0) // not exhausted + && !p->HasAura(PlayerBuff[(j+1)%3],0) // not on another beam + && !p->HasAura(PlayerBuff[(j+2)%3],0) + && IsBetween(me, p, portal)) // on the beam + pTarget = p; + } } - // create new one and start beaming on the target - if (Creature *beamer = portal->SummonCreature(PortalID[j],portal->GetPositionX(),portal->GetPositionY(),portal->GetPositionZ(),portal->GetOrientation(),TEMPSUMMON_TIMED_DESPAWN,60000)) + // buff the target + if (pTarget->GetTypeId() == TYPEID_PLAYER) + pTarget->AddAura(PlayerBuff[j], pTarget); + else + pTarget->AddAura(NetherBuff[j], pTarget); + // cast visual beam on the chosen target if switched + // simple target switching isn't working -> using BeamerGUID to cast (workaround) + if (!current || pTarget != current) { - beamer->CastSpell(pTarget, PortalBeam[j], false); - BeamerGUID[j] = beamer->GetGUID(); + BeamTarget[j] = pTarget->GetGUID(); + // remove currently beaming portal + if (Creature *beamer = Unit::GetCreature(*portal, BeamerGUID[j])) + { + beamer->CastSpell(pTarget, PortalBeam[j], false); + beamer->DisappearAndDie(); + BeamerGUID[j] = 0; + } + // create new one and start beaming on the target + if (Creature *beamer = portal->SummonCreature(PortalID[j],portal->GetPositionX(),portal->GetPositionY(),portal->GetPositionZ(),portal->GetOrientation(),TEMPSUMMON_TIMED_DESPAWN,60000)) + { + beamer->CastSpell(pTarget, PortalBeam[j], false); + BeamerGUID[j] = beamer->GetGUID(); + } } + // aggro target if Red Beam + if (j == RED_PORTAL && me->getVictim() != pTarget && pTarget->GetTypeId() == TYPEID_PLAYER) + me->getThreatManager().addThreat(pTarget, 100000.0f+DoGetThreat(me->getVictim())); } - // aggro target if Red Beam - if (j == RED_PORTAL && me->getVictim() != pTarget && pTarget->GetTypeId() == TYPEID_PLAYER) - me->getThreatManager().addThreat(pTarget, 100000.0f+DoGetThreat(me->getVictim())); - } - } - - void SwitchToPortalPhase() - { - me->RemoveAurasDueToSpell(SPELL_BANISH_ROOT); - me->RemoveAurasDueToSpell(SPELL_BANISH_VISUAL); - SummonPortals(); - PhaseTimer = 60000; - PortalPhase = true; - PortalTimer = 10000; - EmpowermentTimer = 10000; - DoScriptText(EMOTE_PHASE_PORTAL,me); - } - - void SwitchToBanishPhase() - { - me->RemoveAurasDueToSpell(SPELL_EMPOWERMENT); - me->RemoveAurasDueToSpell(SPELL_NETHERBURN_AURA); - DoCast(me, SPELL_BANISH_VISUAL, true); - DoCast(me, SPELL_BANISH_ROOT, true); - DestroyPortals(); - PhaseTimer = 30000; - PortalPhase = false; - DoScriptText(EMOTE_PHASE_BANISH,me); - - for (int i=0; i<3; ++i) - me->RemoveAurasDueToSpell(NetherBuff[i]); - } - - void HandleDoors(bool open) // Massive Door switcher - { - if (GameObject *Door = GameObject::GetGameObject(*me, pInstance ? pInstance->GetData64(DATA_GO_MASSIVE_DOOR) : 0)) - Door->SetGoState(open ? GO_STATE_ACTIVE : GO_STATE_READY); - } + } - void EnterCombat(Unit * /*who*/) - { - HandleDoors(false); - SwitchToPortalPhase(); - } + void SwitchToPortalPhase() + { + me->RemoveAurasDueToSpell(SPELL_BANISH_ROOT); + me->RemoveAurasDueToSpell(SPELL_BANISH_VISUAL); + SummonPortals(); + PhaseTimer = 60000; + PortalPhase = true; + PortalTimer = 10000; + EmpowermentTimer = 10000; + DoScriptText(EMOTE_PHASE_PORTAL,me); + } - void JustDied(Unit* /*killer*/) - { - HandleDoors(true); - DestroyPortals(); - } + void SwitchToBanishPhase() + { + me->RemoveAurasDueToSpell(SPELL_EMPOWERMENT); + me->RemoveAurasDueToSpell(SPELL_NETHERBURN_AURA); + DoCast(me, SPELL_BANISH_VISUAL, true); + DoCast(me, SPELL_BANISH_ROOT, true); + DestroyPortals(); + PhaseTimer = 30000; + PortalPhase = false; + DoScriptText(EMOTE_PHASE_BANISH,me); + + for (int i=0; i<3; ++i) + me->RemoveAurasDueToSpell(NetherBuff[i]); + } - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + void HandleDoors(bool open) // Massive Door switcher + { + if (GameObject *Door = GameObject::GetGameObject(*me, pInstance ? pInstance->GetData64(DATA_GO_MASSIVE_DOOR) : 0)) + Door->SetGoState(open ? GO_STATE_ACTIVE : GO_STATE_READY); + } - // Void Zone - if (VoidZoneTimer <= diff) + void EnterCombat(Unit * /*who*/) { - DoCast(SelectTarget(SELECT_TARGET_RANDOM,1,45,true),SPELL_VOIDZONE,true); - VoidZoneTimer = 15000; - } else VoidZoneTimer -= diff; + HandleDoors(false); + SwitchToPortalPhase(); + } - // NetherInfusion Berserk - if (!Berserk && NetherInfusionTimer <= diff) + void JustDied(Unit* /*killer*/) { - me->AddAura(SPELL_NETHER_INFUSION, me); - DoCast(me, SPELL_NETHERSPITE_ROAR); - Berserk = true; - } else NetherInfusionTimer -= diff; + HandleDoors(true); + DestroyPortals(); + } - if (PortalPhase) // PORTAL PHASE + void UpdateAI(const uint32 diff) { - // Distribute beams and buffs - if (PortalTimer <= diff) + if (!UpdateVictim()) + return; + + // Void Zone + if (VoidZoneTimer <= diff) { - UpdatePortals(); - PortalTimer = 1000; - } else PortalTimer -= diff; + DoCast(SelectTarget(SELECT_TARGET_RANDOM,1,45,true),SPELL_VOIDZONE,true); + VoidZoneTimer = 15000; + } else VoidZoneTimer -= diff; - // Empowerment & Nether Burn - if (EmpowermentTimer <= diff) + // NetherInfusion Berserk + if (!Berserk && NetherInfusionTimer <= diff) { - DoCast(me, SPELL_EMPOWERMENT); - me->AddAura(SPELL_NETHERBURN_AURA, me); - EmpowermentTimer = 90000; - } else EmpowermentTimer -= diff; + me->AddAura(SPELL_NETHER_INFUSION, me); + DoCast(me, SPELL_NETHERSPITE_ROAR); + Berserk = true; + } else NetherInfusionTimer -= diff; - if (PhaseTimer <= diff) + if (PortalPhase) // PORTAL PHASE { - if (!me->IsNonMeleeSpellCasted(false)) + // Distribute beams and buffs + if (PortalTimer <= diff) { - SwitchToBanishPhase(); - return; - } - } else PhaseTimer -= diff; - } - else // BANISH PHASE - { - // Netherbreath - if (NetherbreathTimer <= diff) - { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM,0,40,true)) - DoCast(pTarget, SPELL_NETHERBREATH); - NetherbreathTimer = urand(5000,7000); - } else NetherbreathTimer -= diff; + UpdatePortals(); + PortalTimer = 1000; + } else PortalTimer -= diff; + + // Empowerment & Nether Burn + if (EmpowermentTimer <= diff) + { + DoCast(me, SPELL_EMPOWERMENT); + me->AddAura(SPELL_NETHERBURN_AURA, me); + EmpowermentTimer = 90000; + } else EmpowermentTimer -= diff; - if (PhaseTimer <= diff) + if (PhaseTimer <= diff) + { + if (!me->IsNonMeleeSpellCasted(false)) + { + SwitchToBanishPhase(); + return; + } + } else PhaseTimer -= diff; + } + else // BANISH PHASE { - if (!me->IsNonMeleeSpellCasted(false)) + // Netherbreath + if (NetherbreathTimer <= diff) { - SwitchToPortalPhase(); - return; - } - } else PhaseTimer -= diff; + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM,0,40,true)) + DoCast(pTarget, SPELL_NETHERBREATH); + NetherbreathTimer = urand(5000,7000); + } else NetherbreathTimer -= diff; + + if (PhaseTimer <= diff) + { + if (!me->IsNonMeleeSpellCasted(false)) + { + SwitchToPortalPhase(); + return; + } + } else PhaseTimer -= diff; + } + + DoMeleeAttackIfReady(); } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_netherspite(Creature *pCreature) -{ - return new boss_netherspiteAI(pCreature); -} void AddSC_boss_netherspite() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_netherspite"; - newscript->GetAI = GetAI_boss_netherspite; - newscript->RegisterSelf(); + new boss_netherspite(); } diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp index cb5d592b04f..b42830232ee 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp @@ -57,364 +57,366 @@ float IntroWay[8][3] = {-11140 , -1915 ,122}, {-11163 , -1903 ,91.473} }; - -struct boss_nightbaneAI : public ScriptedAI +
class boss_nightbane : public CreatureScript { - boss_nightbaneAI(Creature* c) : ScriptedAI(c) - { - pInstance = c->GetInstanceData(); - Intro = true; - } - - ScriptedInstance* pInstance; - - uint32 Phase; - - bool RainBones; - bool Skeletons; - - uint32 BellowingRoarTimer; - uint32 CharredEarthTimer; - uint32 DistractingAshTimer; - uint32 SmolderingBreathTimer; - uint32 TailSweepTimer; - uint32 RainofBonesTimer; - uint32 SmokingBlastTimer; - uint32 FireballBarrageTimer; - uint32 SearingCindersTimer; - - uint32 FlyCount; - uint32 FlyTimer; - - bool Intro; - bool Flying; - bool Movement; +public: + boss_nightbane() : CreatureScript("boss_nightbane") { } - uint32 WaitTimer; - uint32 MovePhase; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - BellowingRoarTimer = 30000; - CharredEarthTimer = 15000; - DistractingAshTimer = 20000; - SmolderingBreathTimer = 10000; - TailSweepTimer = 12000; - RainofBonesTimer = 10000; - SmokingBlastTimer = 20000; - FireballBarrageTimer = 13000; - SearingCindersTimer = 14000; - WaitTimer = 1000; - - Phase =1; - FlyCount = 0; - MovePhase = 0; - - me->SetSpeed(MOVE_RUN, 2.0f); - me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); - me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - me->setActive(true); - - if (pInstance) - { - if (pInstance->GetData(TYPE_NIGHTBANE) == DONE || pInstance->GetData(TYPE_NIGHTBANE) == IN_PROGRESS) - me->DisappearAndDie(); - else - pInstance->SetData(TYPE_NIGHTBANE, NOT_STARTED); - } - - HandleTerraceDoors(true); - - Flying = false; - Movement = false; - - if (!Intro) - { - me->SetHomePosition(IntroWay[7][0],IntroWay[7][1],IntroWay[7][2],0); - me->GetMotionMaster()->MoveTargetedHome(); - } + return new boss_nightbaneAI (pCreature); } - void HandleTerraceDoors(bool open) + struct boss_nightbaneAI : public ScriptedAI { - if (pInstance) + boss_nightbaneAI(Creature* c) : ScriptedAI(c) { - pInstance->HandleGameObject(pInstance->GetData64(DATA_MASTERS_TERRACE_DOOR_1), open); - pInstance->HandleGameObject(pInstance->GetData64(DATA_MASTERS_TERRACE_DOOR_2), open); + pInstance = c->GetInstanceScript(); + Intro = true; } - } - void EnterCombat(Unit * /*who*/) - { - if (pInstance) - pInstance->SetData(TYPE_NIGHTBANE, IN_PROGRESS); + InstanceScript* pInstance; - HandleTerraceDoors(false); - me->MonsterYell(YELL_AGGRO, LANG_UNIVERSAL, NULL); - } + uint32 Phase; - void AttackStart(Unit* who) - { - if (!Intro && !Flying) - ScriptedAI::AttackStart(who); - } + bool RainBones; + bool Skeletons; - void JustDied(Unit* /*killer*/) - { - if (pInstance) - pInstance->SetData(TYPE_NIGHTBANE, DONE); + uint32 BellowingRoarTimer; + uint32 CharredEarthTimer; + uint32 DistractingAshTimer; + uint32 SmolderingBreathTimer; + uint32 TailSweepTimer; + uint32 RainofBonesTimer; + uint32 SmokingBlastTimer; + uint32 FireballBarrageTimer; + uint32 SearingCindersTimer; - HandleTerraceDoors(true); - } + uint32 FlyCount; + uint32 FlyTimer; - void MoveInLineOfSight(Unit *who) - { - if (!Intro && !Flying) - ScriptedAI::MoveInLineOfSight(who); - } + bool Intro; + bool Flying; + bool Movement; - void MovementInform(uint32 type, uint32 id) - { - if (type != POINT_MOTION_TYPE) - return; + uint32 WaitTimer; + uint32 MovePhase; - if (Intro) + void Reset() { - if (id >= 8) + BellowingRoarTimer = 30000; + CharredEarthTimer = 15000; + DistractingAshTimer = 20000; + SmolderingBreathTimer = 10000; + TailSweepTimer = 12000; + RainofBonesTimer = 10000; + SmokingBlastTimer = 20000; + FireballBarrageTimer = 13000; + SearingCindersTimer = 14000; + WaitTimer = 1000; + + Phase =1; + FlyCount = 0; + MovePhase = 0; + + me->SetSpeed(MOVE_RUN, 2.0f); + me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + me->setActive(true); + + if (pInstance) { - Intro = false; - me->SetHomePosition(IntroWay[7][0],IntroWay[7][1],IntroWay[7][2],0); - return; + if (pInstance->GetData(TYPE_NIGHTBANE) == DONE || pInstance->GetData(TYPE_NIGHTBANE) == IN_PROGRESS) + me->DisappearAndDie(); + else + pInstance->SetData(TYPE_NIGHTBANE, NOT_STARTED); } - WaitTimer = 1; - } + HandleTerraceDoors(true); - if (Flying) - { - if (id == 0) - { - me->MonsterTextEmote(EMOTE_BREATH, 0, true); - Flying = false; - Phase = 2; - return; - } + Flying = false; + Movement = false; - if (id == 3) + if (!Intro) { - MovePhase = 4; - WaitTimer = 1; - return; + me->SetHomePosition(IntroWay[7][0],IntroWay[7][1],IntroWay[7][2],0); + me->GetMotionMaster()->MoveTargetedHome(); } + } - if (id == 8) + void HandleTerraceDoors(bool open) + { + if (pInstance) { - Flying = false; - Phase = 1; - Movement = true; - return; + pInstance->HandleGameObject(pInstance->GetData64(DATA_MASTERS_TERRACE_DOOR_1), open); + pInstance->HandleGameObject(pInstance->GetData64(DATA_MASTERS_TERRACE_DOOR_2), open); } - - WaitTimer = 1; } - } - void JustSummoned(Creature *summoned) - { - summoned->AI()->AttackStart(me->getVictim()); - } + void EnterCombat(Unit * /*who*/) + { + if (pInstance) + pInstance->SetData(TYPE_NIGHTBANE, IN_PROGRESS); - void TakeOff() - { - me->MonsterYell(YELL_FLY_PHASE, LANG_UNIVERSAL, NULL); + HandleTerraceDoors(false); + me->MonsterYell(YELL_AGGRO, LANG_UNIVERSAL, NULL); + } - me->InterruptSpell(CURRENT_GENERIC_SPELL); - me->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF); - me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); - (*me).GetMotionMaster()->Clear(false); - (*me).GetMotionMaster()->MovePoint(0,IntroWay[2][0],IntroWay[2][1],IntroWay[2][2]); + void AttackStart(Unit* who) + { + if (!Intro && !Flying) + ScriptedAI::AttackStart(who); + } - Flying = true; + void JustDied(Unit* /*killer*/) + { + if (pInstance) + pInstance->SetData(TYPE_NIGHTBANE, DONE); - FlyTimer = urand(45000,60000); //timer wrong between 45 and 60 seconds - ++FlyCount; + HandleTerraceDoors(true); + } - RainofBonesTimer = 5000; //timer wrong (maybe) - RainBones = false; - Skeletons = false; - } + void MoveInLineOfSight(Unit *who) + { + if (!Intro && !Flying) + ScriptedAI::MoveInLineOfSight(who); + } - void UpdateAI(const uint32 diff) - { - /* The timer for this was never setup apparently, not sure if the code works properly: - if (WaitTimer <= diff) + void MovementInform(uint32 type, uint32 id) { + if (type != POINT_MOTION_TYPE) + return; + if (Intro) { - if (MovePhase >= 7) - { - me->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING); - me->HandleEmoteCommand(EMOTE_ONESHOT_LAND); - me->GetMotionMaster()->MovePoint(8,IntroWay[7][0],IntroWay[7][1],IntroWay[7][2]); - } - else + if (id >= 8) { - me->GetMotionMaster()->MovePoint(MovePhase,IntroWay[MovePhase][0],IntroWay[MovePhase][1],IntroWay[MovePhase][2]); - ++MovePhase; + Intro = false; + me->SetHomePosition(IntroWay[7][0],IntroWay[7][1],IntroWay[7][2],0); + return; } + + WaitTimer = 1; } + if (Flying) { - if (MovePhase >= 7) + if (id == 0) { - me->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING); - me->HandleEmoteCommand(EMOTE_ONESHOT_LAND); - me->GetMotionMaster()->MovePoint(8,IntroWay[7][0],IntroWay[7][1],IntroWay[7][2]); + me->MonsterTextEmote(EMOTE_BREATH, 0, true); + Flying = false; + Phase = 2; + return; } - else + + if (id == 3) + { + MovePhase = 4; + WaitTimer = 1; + return; + } + + if (id == 8) { - me->GetMotionMaster()->MovePoint(MovePhase,IntroWay[MovePhase][0],IntroWay[MovePhase][1],IntroWay[MovePhase][2]); - ++MovePhase; + Flying = false; + Phase = 1; + Movement = true; + return; } + + WaitTimer = 1; } + } + + void JustSummoned(Creature *summoned) + { + summoned->AI()->AttackStart(me->getVictim()); + } + + void TakeOff() + { + me->MonsterYell(YELL_FLY_PHASE, LANG_UNIVERSAL, NULL); - WaitTimer = 0; - } else WaitTimer -= diff; - */ + me->InterruptSpell(CURRENT_GENERIC_SPELL); + me->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF); + me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + (*me).GetMotionMaster()->Clear(false); + (*me).GetMotionMaster()->MovePoint(0,IntroWay[2][0],IntroWay[2][1],IntroWay[2][2]); - if (!UpdateVictim()) - return; + Flying = true; - if (Flying) - return; + FlyTimer = urand(45000,60000); //timer wrong between 45 and 60 seconds + ++FlyCount; - // Phase 1 "GROUND FIGHT" - if (Phase == 1) + RainofBonesTimer = 5000; //timer wrong (maybe) + RainBones = false; + Skeletons = false; + } + + void UpdateAI(const uint32 diff) { - if (Movement) + /* The timer for this was never setup apparently, not sure if the code works properly: + if (WaitTimer <= diff) { - DoStartMovement(me->getVictim()); - Movement = false; - } + if (Intro) + { + if (MovePhase >= 7) + { + me->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + me->HandleEmoteCommand(EMOTE_ONESHOT_LAND); + me->GetMotionMaster()->MovePoint(8,IntroWay[7][0],IntroWay[7][1],IntroWay[7][2]); + } + else + { + me->GetMotionMaster()->MovePoint(MovePhase,IntroWay[MovePhase][0],IntroWay[MovePhase][1],IntroWay[MovePhase][2]); + ++MovePhase; + } + } + if (Flying) + { + if (MovePhase >= 7) + { + me->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + me->HandleEmoteCommand(EMOTE_ONESHOT_LAND); + me->GetMotionMaster()->MovePoint(8,IntroWay[7][0],IntroWay[7][1],IntroWay[7][2]); + } + else + { + me->GetMotionMaster()->MovePoint(MovePhase,IntroWay[MovePhase][0],IntroWay[MovePhase][1],IntroWay[MovePhase][2]); + ++MovePhase; + } + } - if (BellowingRoarTimer <= diff) - { - DoCast(me->getVictim(), SPELL_BELLOWING_ROAR); - BellowingRoarTimer = urand(30000,40000); - } else BellowingRoarTimer -= diff; + WaitTimer = 0; + } else WaitTimer -= diff; + */ - if (SmolderingBreathTimer <= diff) - { - DoCast(me->getVictim(), SPELL_SMOLDERING_BREATH); - SmolderingBreathTimer = 20000; - } else SmolderingBreathTimer -= diff; + if (!UpdateVictim()) + return; - if (CharredEarthTimer <= diff) - { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(pTarget, SPELL_CHARRED_EARTH); - CharredEarthTimer = 20000; - } else CharredEarthTimer -= diff; + if (Flying) + return; - if (TailSweepTimer <= diff) + // Phase 1 "GROUND FIGHT" + if (Phase == 1) { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - if (!me->HasInArc(M_PI, pTarget)) - DoCast(pTarget, SPELL_TAIL_SWEEP); - TailSweepTimer = 15000; - } else TailSweepTimer -= diff; + if (Movement) + { + DoStartMovement(me->getVictim()); + Movement = false; + } - if (SearingCindersTimer <= diff) - { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(pTarget, SPELL_SEARING_CINDERS); - SearingCindersTimer = 10000; - } else SearingCindersTimer -= diff; + if (BellowingRoarTimer <= diff) + { + DoCast(me->getVictim(), SPELL_BELLOWING_ROAR); + BellowingRoarTimer = urand(30000,40000); + } else BellowingRoarTimer -= diff; - uint32 Prozent; - Prozent = (me->GetHealth()*100) / me->GetMaxHealth(); + if (SmolderingBreathTimer <= diff) + { + DoCast(me->getVictim(), SPELL_SMOLDERING_BREATH); + SmolderingBreathTimer = 20000; + } else SmolderingBreathTimer -= diff; - if (Prozent < 75 && FlyCount == 0) // first take off 75% - TakeOff(); + if (CharredEarthTimer <= diff) + { + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + DoCast(pTarget, SPELL_CHARRED_EARTH); + CharredEarthTimer = 20000; + } else CharredEarthTimer -= diff; - if (Prozent < 50 && FlyCount == 1) // secound take off 50% - TakeOff(); + if (TailSweepTimer <= diff) + { + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + if (!me->HasInArc(M_PI, pTarget)) + DoCast(pTarget, SPELL_TAIL_SWEEP); + TailSweepTimer = 15000; + } else TailSweepTimer -= diff; - if (Prozent < 25 && FlyCount == 2) // third take off 25% - TakeOff(); + if (SearingCindersTimer <= diff) + { + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + DoCast(pTarget, SPELL_SEARING_CINDERS); + SearingCindersTimer = 10000; + } else SearingCindersTimer -= diff; - DoMeleeAttackIfReady(); - } + uint32 Prozent; + Prozent = (me->GetHealth()*100) / me->GetMaxHealth(); - //Phase 2 "FLYING FIGHT" - if (Phase == 2) - { - if (!RainBones) + if (Prozent < 75 && FlyCount == 0) // first take off 75% + TakeOff(); + + if (Prozent < 50 && FlyCount == 1) // secound take off 50% + TakeOff(); + + if (Prozent < 25 && FlyCount == 2) // third take off 25% + TakeOff(); + + DoMeleeAttackIfReady(); + } + + //Phase 2 "FLYING FIGHT" + if (Phase == 2) { - if (!Skeletons) + if (!RainBones) { - for (uint8 i = 0; i <= 3; ++i) + if (!Skeletons) { - DoCast(me->getVictim(), SPELL_SUMMON_SKELETON); - Skeletons = true; + for (uint8 i = 0; i <= 3; ++i) + { + DoCast(me->getVictim(), SPELL_SUMMON_SKELETON); + Skeletons = true; + } } + + if (RainofBonesTimer < diff && !RainBones) // only once at the beginning of phase 2 + { + DoCast(me->getVictim(), SPELL_RAIN_OF_BONES); + RainBones = true; + SmokingBlastTimer = 20000; + } else RainofBonesTimer -= diff; + + if (DistractingAshTimer <= diff) + { + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + DoCast(pTarget, SPELL_DISTRACTING_ASH); + DistractingAshTimer = 2000; //timer wrong + } else DistractingAshTimer -= diff; } - if (RainofBonesTimer < diff && !RainBones) // only once at the beginning of phase 2 + if (RainBones) { - DoCast(me->getVictim(), SPELL_RAIN_OF_BONES); - RainBones = true; - SmokingBlastTimer = 20000; - } else RainofBonesTimer -= diff; + if (SmokingBlastTimer <= diff) + { + DoCast(me->getVictim(), SPELL_SMOKING_BLAST); + SmokingBlastTimer = 1500; //timer wrong + } else SmokingBlastTimer -= diff; + } - if (DistractingAshTimer <= diff) + if (FireballBarrageTimer <= diff) { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(pTarget, SPELL_DISTRACTING_ASH); - DistractingAshTimer = 2000; //timer wrong - } else DistractingAshTimer -= diff; - } - - if (RainBones) - { - if (SmokingBlastTimer <= diff) - { - DoCast(me->getVictim(), SPELL_SMOKING_BLAST); - SmokingBlastTimer = 1500; //timer wrong - } else SmokingBlastTimer -= diff; - } - - if (FireballBarrageTimer <= diff) - { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_FARTHEST, 0)) - DoCast(pTarget, SPELL_FIREBALL_BARRAGE); - FireballBarrageTimer = 20000; - } else FireballBarrageTimer -= diff; + if (Unit *pTarget = SelectUnit(SELECT_TARGET_FARTHEST, 0)) + DoCast(pTarget, SPELL_FIREBALL_BARRAGE); + FireballBarrageTimer = 20000; + } else FireballBarrageTimer -= diff; - if (FlyTimer <= diff) //landing - { - me->MonsterYell(RAND(*YELL_LAND_PHASE_1,*YELL_LAND_PHASE_2), LANG_UNIVERSAL, NULL); + if (FlyTimer <= diff) //landing + { + me->MonsterYell(RAND(*YELL_LAND_PHASE_1,*YELL_LAND_PHASE_2), LANG_UNIVERSAL, NULL); - me->GetMotionMaster()->Clear(false); - me->GetMotionMaster()->MovePoint(3,IntroWay[3][0],IntroWay[3][1],IntroWay[3][2]); + me->GetMotionMaster()->Clear(false); + me->GetMotionMaster()->MovePoint(3,IntroWay[3][0],IntroWay[3][1],IntroWay[3][2]); - Flying = true; - } else FlyTimer -= diff; + Flying = true; + } else FlyTimer -= diff; + } } - } + }; + }; -CreatureAI* GetAI_boss_nightbane(Creature* pCreature) -{ - return new boss_nightbaneAI (pCreature); -} void AddSC_boss_nightbane() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_nightbane"; - newscript->GetAI = &GetAI_boss_nightbane; - newscript->RegisterSelf(); + new boss_nightbane(); } - diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp index aea8703f2f2..904c040722d 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp @@ -95,512 +95,513 @@ static InfernalPoint InfernalPoints[] = #define EQUIP_ID_AXE 33542 //Axes info -//---------Infernal code first -struct netherspite_infernalAI : public ScriptedAI +//---------Infernal code first
class netherspite_infernal : public CreatureScript { - netherspite_infernalAI(Creature *c) : ScriptedAI(c) , - malchezaar(0), HellfireTimer(0), CleanupTimer(0), point(NULL) {} +public: + netherspite_infernal() : CreatureScript("netherspite_infernal") { } - uint32 HellfireTimer; - uint32 CleanupTimer; - uint32 malchezaar; - InfernalPoint *point; - - void Reset() {} - void EnterCombat(Unit * /*who*/) {} - void MoveInLineOfSight(Unit * /*who*/) {} + CreatureAI* GetAI(Creature* pCreature) const + { + return new netherspite_infernalAI (pCreature); + } - void UpdateAI(const uint32 diff) + struct netherspite_infernalAI : public ScriptedAI { - if (HellfireTimer) - if (HellfireTimer <= diff) + netherspite_infernalAI(Creature *c) : ScriptedAI(c) , + malchezaar(0), HellfireTimer(0), CleanupTimer(0), point(NULL) {} + + uint32 HellfireTimer; + uint32 CleanupTimer; + uint32 malchezaar; + InfernalPoint *point; + + void Reset() {} + void EnterCombat(Unit * /*who*/) {} + void MoveInLineOfSight(Unit * /*who*/) {} + + void UpdateAI(const uint32 diff) { - DoCast(me, SPELL_HELLFIRE); - HellfireTimer = 0; + if (HellfireTimer) + if (HellfireTimer <= diff) + { + DoCast(me, SPELL_HELLFIRE); + HellfireTimer = 0; + } + else HellfireTimer -= diff; + + if (CleanupTimer) + if (CleanupTimer <= diff) + { + Cleanup(); + CleanupTimer = 0; + } else CleanupTimer -= diff; } - else HellfireTimer -= diff; - if (CleanupTimer) - if (CleanupTimer <= diff) + void KilledUnit(Unit *who) { - Cleanup(); - CleanupTimer = 0; - } else CleanupTimer -= diff; - } + Unit *pMalchezaar = Unit::GetUnit(*me, malchezaar); + if (pMalchezaar) + CAST_CRE(pMalchezaar)->AI()->KilledUnit(who); + } - void KilledUnit(Unit *who) - { - Unit *pMalchezaar = Unit::GetUnit(*me, malchezaar); - if (pMalchezaar) - CAST_CRE(pMalchezaar)->AI()->KilledUnit(who); - } + void SpellHit(Unit * /*who*/, const SpellEntry *spell) + { + if (spell->Id == SPELL_INFERNAL_RELAY) + { + me->SetDisplayId(me->GetUInt32Value(UNIT_FIELD_NATIVEDISPLAYID)); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + HellfireTimer = 4000; + CleanupTimer = 170000; + } + } - void SpellHit(Unit * /*who*/, const SpellEntry *spell) - { - if (spell->Id == SPELL_INFERNAL_RELAY) + void DamageTaken(Unit *done_by, uint32 &damage) { - me->SetDisplayId(me->GetUInt32Value(UNIT_FIELD_NATIVEDISPLAYID)); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - HellfireTimer = 4000; - CleanupTimer = 170000; + if (done_by->GetGUID() != malchezaar) + damage = 0; } - } - void DamageTaken(Unit *done_by, uint32 &damage) - { - if (done_by->GetGUID() != malchezaar) - damage = 0; - } + void Cleanup() + { + Unit *pMalchezaar = Unit::GetUnit(*me, malchezaar); + + if (pMalchezaar && pMalchezaar->isAlive()) + CAST_AI(boss_malchezaar::boss_malchezaarAI, CAST_CRE(pMalchezaar)->AI())->Cleanup(me, point); + }
//below ... + }; - void Cleanup(); //below ... }; - -struct boss_malchezaarAI : public ScriptedAI +
class boss_malchezaar : public CreatureScript { - boss_malchezaarAI(Creature *c) : ScriptedAI(c) - { - pInstance = c->GetInstanceData(); - } - - ScriptedInstance *pInstance; - uint32 EnfeebleTimer; - uint32 EnfeebleResetTimer; - uint32 ShadowNovaTimer; - uint32 SWPainTimer; - uint32 SunderArmorTimer; - uint32 AmplifyDamageTimer; - uint32 Cleave_Timer; - uint32 InfernalTimer; - uint32 AxesTargetSwitchTimer; - uint32 InfernalCleanupTimer; - - std::vector<uint64> infernals; - std::vector<InfernalPoint*> positions; - - uint64 axes[2]; - uint64 enfeeble_targets[5]; - uint64 enfeeble_health[5]; - - uint32 phase; +public: + boss_malchezaar() : CreatureScript("boss_malchezaar") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - AxesCleanup(); - ClearWeapons(); - InfernalCleanup(); - positions.clear(); - - for (uint8 i = 0; i < 5; ++i) - enfeeble_targets[i] = 0; - - for (uint8 i = 0; i < TOTAL_INFERNAL_POINTS; ++i) - positions.push_back(&InfernalPoints[i]); - - EnfeebleTimer = 30000; - EnfeebleResetTimer = 38000; - ShadowNovaTimer = 35500; - SWPainTimer = 20000; - AmplifyDamageTimer = 5000; - Cleave_Timer = 8000; - InfernalTimer = 45000; - InfernalCleanupTimer = 47000; - AxesTargetSwitchTimer = urand(7500,20000); - SunderArmorTimer = urand(5000,10000); - phase = 1; - - if (pInstance) - pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_NETHER_DOOR), true); + return new boss_malchezaarAI (pCreature); } - void KilledUnit(Unit * /*victim*/) + struct boss_malchezaarAI : public ScriptedAI { - DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2,SAY_SLAY3), me); - } + boss_malchezaarAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } - void JustDied(Unit * /*victim*/) - { - DoScriptText(SAY_DEATH, me); + InstanceScript *pInstance; + uint32 EnfeebleTimer; + uint32 EnfeebleResetTimer; + uint32 ShadowNovaTimer; + uint32 SWPainTimer; + uint32 SunderArmorTimer; + uint32 AmplifyDamageTimer; + uint32 Cleave_Timer; + uint32 InfernalTimer; + uint32 AxesTargetSwitchTimer; + uint32 InfernalCleanupTimer; - AxesCleanup(); - ClearWeapons(); - InfernalCleanup(); - positions.clear(); + std::vector<uint64> infernals; + std::vector<InfernalPoint*> positions; - for (uint8 i = 0; i < TOTAL_INFERNAL_POINTS; ++i) - positions.push_back(&InfernalPoints[i]); + uint64 axes[2]; + uint64 enfeeble_targets[5]; + uint64 enfeeble_health[5]; - if (pInstance) - pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_NETHER_DOOR), true); - } + uint32 phase; - void EnterCombat(Unit * /*who*/) - { - DoScriptText(SAY_AGGRO, me); + void Reset() + { + AxesCleanup(); + ClearWeapons(); + InfernalCleanup(); + positions.clear(); + + for (uint8 i = 0; i < 5; ++i) + enfeeble_targets[i] = 0; + + for (uint8 i = 0; i < TOTAL_INFERNAL_POINTS; ++i) + positions.push_back(&InfernalPoints[i]); + + EnfeebleTimer = 30000; + EnfeebleResetTimer = 38000; + ShadowNovaTimer = 35500; + SWPainTimer = 20000; + AmplifyDamageTimer = 5000; + Cleave_Timer = 8000; + InfernalTimer = 45000; + InfernalCleanupTimer = 47000; + AxesTargetSwitchTimer = urand(7500,20000); + SunderArmorTimer = urand(5000,10000); + phase = 1; + + if (pInstance) + pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_NETHER_DOOR), true); + } - if (pInstance) - pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_NETHER_DOOR), false); // Open the door leading further in - } + void KilledUnit(Unit * /*victim*/) + { + DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2,SAY_SLAY3), me); + } - void InfernalCleanup() - { - //Infernal Cleanup - for (std::vector<uint64>::const_iterator itr = infernals.begin(); itr != infernals.end(); ++itr) - if (Unit *pInfernal = Unit::GetUnit(*me, *itr)) - if (pInfernal->isAlive()) - { - pInfernal->SetVisibility(VISIBILITY_OFF); - pInfernal->setDeathState(JUST_DIED); - } + void JustDied(Unit * /*victim*/) + { + DoScriptText(SAY_DEATH, me); - infernals.clear(); - } + AxesCleanup(); + ClearWeapons(); + InfernalCleanup(); + positions.clear(); - void AxesCleanup() - { - for (uint8 i = 0; i < 2; ++i) + for (uint8 i = 0; i < TOTAL_INFERNAL_POINTS; ++i) + positions.push_back(&InfernalPoints[i]); + + if (pInstance) + pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_NETHER_DOOR), true); + } + + void EnterCombat(Unit * /*who*/) { - Unit *axe = Unit::GetUnit(*me, axes[i]); - if (axe && axe->isAlive()) - axe->Kill(axe); - axes[i] = 0; + DoScriptText(SAY_AGGRO, me); + + if (pInstance) + pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_NETHER_DOOR), false); // Open the door leading further in } - } - void ClearWeapons() - { - SetEquipmentSlots(false, EQUIP_UNEQUIP, EQUIP_UNEQUIP, EQUIP_NO_CHANGE); + void InfernalCleanup() + { + //Infernal Cleanup + for (std::vector<uint64>::const_iterator itr = infernals.begin(); itr != infernals.end(); ++itr) + if (Unit *pInfernal = Unit::GetUnit(*me, *itr)) + if (pInfernal->isAlive()) + { + pInfernal->SetVisibility(VISIBILITY_OFF); + pInfernal->setDeathState(JUST_DIED); + } - //damage - const CreatureInfo *cinfo = me->GetCreatureInfo(); - me->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, cinfo->mindmg); - me->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, cinfo->maxdmg); - me->UpdateDamagePhysical(BASE_ATTACK); - } + infernals.clear(); + } - void EnfeebleHealthEffect() - { - const SpellEntry *info = GetSpellStore()->LookupEntry(SPELL_ENFEEBLE_EFFECT); - if (!info) - return; - - std::list<HostileReference *> t_list = me->getThreatManager().getThreatList(); - std::vector<Unit *> targets; - - if (!t_list.size()) - return; - - //begin + 1, so we don't target the one with the highest threat - std::list<HostileReference *>::const_iterator itr = t_list.begin(); - std::advance(itr, 1); - for (; itr != t_list.end(); ++itr) //store the threat list in a different container - if (Unit *pTarget = Unit::GetUnit(*me, (*itr)->getUnitGuid())) - if (pTarget->isAlive() && pTarget->GetTypeId() == TYPEID_PLAYER) - targets.push_back(pTarget); - - //cut down to size if we have more than 5 targets - while (targets.size() > 5) - targets.erase(targets.begin()+rand()%targets.size()); - - uint32 i = 0; - for (std::vector<Unit *>::const_iterator iter = targets.begin(); iter != targets.end(); ++iter, ++i) - if (Unit *pTarget = *iter) + void AxesCleanup() + { + for (uint8 i = 0; i < 2; ++i) { - enfeeble_targets[i] = pTarget->GetGUID(); - enfeeble_health[i] = pTarget->GetHealth(); - - pTarget->CastSpell(pTarget, SPELL_ENFEEBLE, true, 0, 0, me->GetGUID()); - pTarget->SetHealth(1); + Unit *axe = Unit::GetUnit(*me, axes[i]); + if (axe && axe->isAlive()) + axe->Kill(axe); + axes[i] = 0; } - } + } - void EnfeebleResetHealth() - { - for (uint8 i = 0; i < 5; ++i) + void ClearWeapons() { - Unit *pTarget = Unit::GetUnit(*me, enfeeble_targets[i]); - if (pTarget && pTarget->isAlive()) - pTarget->SetHealth(enfeeble_health[i]); - enfeeble_targets[i] = 0; - enfeeble_health[i] = 0; + SetEquipmentSlots(false, EQUIP_UNEQUIP, EQUIP_UNEQUIP, EQUIP_NO_CHANGE); + + //damage + const CreatureInfo *cinfo = me->GetCreatureInfo(); + me->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, cinfo->mindmg); + me->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, cinfo->maxdmg); + me->UpdateDamagePhysical(BASE_ATTACK); } - } - void SummonInfernal(const uint32 /*diff*/) - { - InfernalPoint *point = NULL; - Position pos; - if ((me->GetMapId() != 532) || positions.empty()) - me->GetRandomNearPosition(pos, 60); - else + void EnfeebleHealthEffect() { - std::vector<InfernalPoint*>::iterator itr = positions.begin()+rand()%positions.size(); - point = *itr; - positions.erase(itr); - pos.Relocate(point->x, point->y, INFERNAL_Z); - } + const SpellEntry *info = GetSpellStore()->LookupEntry(SPELL_ENFEEBLE_EFFECT); + if (!info) + return; + + std::list<HostileReference *> t_list = me->getThreatManager().getThreatList(); + std::vector<Unit *> targets; - Creature *Infernal = me->SummonCreature(NETHERSPITE_INFERNAL, pos, TEMPSUMMON_TIMED_DESPAWN, 180000); + if (!t_list.size()) + return; + + //begin + 1, so we don't target the one with the highest threat + std::list<HostileReference *>::const_iterator itr = t_list.begin(); + std::advance(itr, 1); + for (; itr != t_list.end(); ++itr) //store the threat list in a different container + if (Unit *pTarget = Unit::GetUnit(*me, (*itr)->getUnitGuid())) + if (pTarget->isAlive() && pTarget->GetTypeId() == TYPEID_PLAYER) + targets.push_back(pTarget); + + //cut down to size if we have more than 5 targets + while (targets.size() > 5) + targets.erase(targets.begin()+rand()%targets.size()); + + uint32 i = 0; + for (std::vector<Unit *>::const_iterator iter = targets.begin(); iter != targets.end(); ++iter, ++i) + if (Unit *pTarget = *iter) + { + enfeeble_targets[i] = pTarget->GetGUID(); + enfeeble_health[i] = pTarget->GetHealth(); + + pTarget->CastSpell(pTarget, SPELL_ENFEEBLE, true, 0, 0, me->GetGUID()); + pTarget->SetHealth(1); + } + } - if (Infernal) + void EnfeebleResetHealth() { - Infernal->SetDisplayId(INFERNAL_MODEL_INVISIBLE); - Infernal->setFaction(me->getFaction()); - if (point) - CAST_AI(netherspite_infernalAI, Infernal->AI())->point=point; - CAST_AI(netherspite_infernalAI, Infernal->AI())->malchezaar=me->GetGUID(); - - infernals.push_back(Infernal->GetGUID()); - DoCast(Infernal, SPELL_INFERNAL_RELAY); + for (uint8 i = 0; i < 5; ++i) + { + Unit *pTarget = Unit::GetUnit(*me, enfeeble_targets[i]); + if (pTarget && pTarget->isAlive()) + pTarget->SetHealth(enfeeble_health[i]); + enfeeble_targets[i] = 0; + enfeeble_health[i] = 0; + } } - DoScriptText(RAND(SAY_SUMMON1,SAY_SUMMON2), me); - } + void SummonInfernal(const uint32 /*diff*/) + { + InfernalPoint *point = NULL; + Position pos; + if ((me->GetMapId() != 532) || positions.empty()) + me->GetRandomNearPosition(pos, 60); + else + { + std::vector<InfernalPoint*>::iterator itr = positions.begin()+rand()%positions.size(); + point = *itr; + positions.erase(itr); + pos.Relocate(point->x, point->y, INFERNAL_Z); + } - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + Creature *Infernal = me->SummonCreature(NETHERSPITE_INFERNAL, pos, TEMPSUMMON_TIMED_DESPAWN, 180000); + + if (Infernal) + { + Infernal->SetDisplayId(INFERNAL_MODEL_INVISIBLE); + Infernal->setFaction(me->getFaction()); + if (point) + CAST_AI(netherspite_infernal::netherspite_infernalAI, Infernal->AI())->point=point; + CAST_AI(netherspite_infernal::netherspite_infernalAI, Infernal->AI())->malchezaar=me->GetGUID(); + + infernals.push_back(Infernal->GetGUID()); + DoCast(Infernal, SPELL_INFERNAL_RELAY); + } + + DoScriptText(RAND(SAY_SUMMON1,SAY_SUMMON2), me); + } - if (EnfeebleResetTimer && EnfeebleResetTimer <= diff) // Let's not forget to reset that + void UpdateAI(const uint32 diff) { - EnfeebleResetHealth(); - EnfeebleResetTimer = 0; - } else EnfeebleResetTimer -= diff; + if (!UpdateVictim()) + return; + + if (EnfeebleResetTimer && EnfeebleResetTimer <= diff) // Let's not forget to reset that + { + EnfeebleResetHealth(); + EnfeebleResetTimer = 0; + } else EnfeebleResetTimer -= diff; - if (me->hasUnitState(UNIT_STAT_STUNNED)) // While shifting to phase 2 malchezaar stuns himself - return; + if (me->hasUnitState(UNIT_STAT_STUNNED)) // While shifting to phase 2 malchezaar stuns himself + return; - if (me->GetUInt64Value(UNIT_FIELD_TARGET) != me->getVictim()->GetGUID()) - me->SetUInt64Value(UNIT_FIELD_TARGET, me->getVictim()->GetGUID()); + if (me->GetUInt64Value(UNIT_FIELD_TARGET) != me->getVictim()->GetGUID()) + me->SetUInt64Value(UNIT_FIELD_TARGET, me->getVictim()->GetGUID()); - if (phase == 1) - { - if ((me->GetHealth()*100) / me->GetMaxHealth() < 60) + if (phase == 1) { - me->InterruptNonMeleeSpells(false); + if ((me->GetHealth()*100) / me->GetMaxHealth() < 60) + { + me->InterruptNonMeleeSpells(false); - phase = 2; + phase = 2; - //animation - DoCast(me, SPELL_EQUIP_AXES); + //animation + DoCast(me, SPELL_EQUIP_AXES); - //text - DoScriptText(SAY_AXE_TOSS1, me); + //text + DoScriptText(SAY_AXE_TOSS1, me); - //passive thrash aura - DoCast(me, SPELL_THRASH_AURA, true); + //passive thrash aura + DoCast(me, SPELL_THRASH_AURA, true); - //models - SetEquipmentSlots(false, EQUIP_ID_AXE, EQUIP_ID_AXE, EQUIP_NO_CHANGE); + //models + SetEquipmentSlots(false, EQUIP_ID_AXE, EQUIP_ID_AXE, EQUIP_NO_CHANGE); - //damage - const CreatureInfo *cinfo = me->GetCreatureInfo(); - me->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, 2*cinfo->mindmg); - me->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, 2*cinfo->maxdmg); - me->UpdateDamagePhysical(BASE_ATTACK); + //damage + const CreatureInfo *cinfo = me->GetCreatureInfo(); + me->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, 2*cinfo->mindmg); + me->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, 2*cinfo->maxdmg); + me->UpdateDamagePhysical(BASE_ATTACK); - me->SetBaseWeaponDamage(OFF_ATTACK, MINDAMAGE, cinfo->mindmg); - me->SetBaseWeaponDamage(OFF_ATTACK, MAXDAMAGE, cinfo->maxdmg); - //Sigh, updating only works on main attack, do it manually .... - me->SetFloatValue(UNIT_FIELD_MINOFFHANDDAMAGE, cinfo->mindmg); - me->SetFloatValue(UNIT_FIELD_MAXOFFHANDDAMAGE, cinfo->maxdmg); + me->SetBaseWeaponDamage(OFF_ATTACK, MINDAMAGE, cinfo->mindmg); + me->SetBaseWeaponDamage(OFF_ATTACK, MAXDAMAGE, cinfo->maxdmg); + //Sigh, updating only works on main attack, do it manually .... + me->SetFloatValue(UNIT_FIELD_MINOFFHANDDAMAGE, cinfo->mindmg); + me->SetFloatValue(UNIT_FIELD_MAXOFFHANDDAMAGE, cinfo->maxdmg); - me->SetAttackTime(OFF_ATTACK, (me->GetAttackTime(BASE_ATTACK)*150)/100); + me->SetAttackTime(OFF_ATTACK, (me->GetAttackTime(BASE_ATTACK)*150)/100); + } } - } - else if (phase == 2) - { - if ((me->GetHealth()*100) / me->GetMaxHealth() < 30) + else if (phase == 2) { - InfernalTimer = 15000; + if ((me->GetHealth()*100) / me->GetMaxHealth() < 30) + { + InfernalTimer = 15000; - phase = 3; + phase = 3; - ClearWeapons(); + ClearWeapons(); - //remove thrash - me->RemoveAurasDueToSpell(SPELL_THRASH_AURA); + //remove thrash + me->RemoveAurasDueToSpell(SPELL_THRASH_AURA); - DoScriptText(SAY_AXE_TOSS2, me); + DoScriptText(SAY_AXE_TOSS2, me); - Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); - for (uint8 i = 0; i < 2; ++i) - { - Creature *axe = me->SummonCreature(MALCHEZARS_AXE, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 1000); - if (axe) + Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); + for (uint8 i = 0; i < 2; ++i) { - axe->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - axe->setFaction(me->getFaction()); - axes[i] = axe->GetGUID(); - if (pTarget) + Creature *axe = me->SummonCreature(MALCHEZARS_AXE, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 1000); + if (axe) { - axe->AI()->AttackStart(pTarget); - //axe->getThreatManager().tauntApply(pTarget); //Taunt Apply and fade out does not work properly - // So we'll use a hack to add a lot of threat to our target - axe->AddThreat(pTarget, 10000000.0f); + axe->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + axe->setFaction(me->getFaction()); + axes[i] = axe->GetGUID(); + if (pTarget) + { + axe->AI()->AttackStart(pTarget); + //axe->getThreatManager().tauntApply(pTarget); //Taunt Apply and fade out does not work properly + // So we'll use a hack to add a lot of threat to our target + axe->AddThreat(pTarget, 10000000.0f); + } } } - } - if (ShadowNovaTimer > 35000) - ShadowNovaTimer = EnfeebleTimer + 5000; + if (ShadowNovaTimer > 35000) + ShadowNovaTimer = EnfeebleTimer + 5000; - return; - } + return; + } - if (SunderArmorTimer <= diff) - { - DoCast(me->getVictim(), SPELL_SUNDER_ARMOR); - SunderArmorTimer = urand(10000,18000); + if (SunderArmorTimer <= diff) + { + DoCast(me->getVictim(), SPELL_SUNDER_ARMOR); + SunderArmorTimer = urand(10000,18000); - } else SunderArmorTimer -= diff; + } else SunderArmorTimer -= diff; - if (Cleave_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_CLEAVE); - Cleave_Timer = urand(6000,12000); + if (Cleave_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_CLEAVE); + Cleave_Timer = urand(6000,12000); - } else Cleave_Timer -= diff; - } - else - { - if (AxesTargetSwitchTimer <= diff) + } else Cleave_Timer -= diff; + } + else { - AxesTargetSwitchTimer = urand(7500,20000); - - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + if (AxesTargetSwitchTimer <= diff) { - for (uint8 i = 0; i < 2; ++i) + AxesTargetSwitchTimer = urand(7500,20000); + + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) { - if (Unit *axe = Unit::GetUnit(*me, axes[i])) + for (uint8 i = 0; i < 2; ++i) { - if (axe->getVictim()) - DoModifyThreatPercent(axe->getVictim(), -100); - if (pTarget) - axe->AddThreat(pTarget, 1000000.0f); - //axe->getThreatManager().tauntFadeOut(axe->getVictim()); - //axe->getThreatManager().tauntApply(pTarget); + if (Unit *axe = Unit::GetUnit(*me, axes[i])) + { + if (axe->getVictim()) + DoModifyThreatPercent(axe->getVictim(), -100); + if (pTarget) + axe->AddThreat(pTarget, 1000000.0f); + //axe->getThreatManager().tauntFadeOut(axe->getVictim()); + //axe->getThreatManager().tauntApply(pTarget); + } } } - } - } else AxesTargetSwitchTimer -= diff; + } else AxesTargetSwitchTimer -= diff; - if (AmplifyDamageTimer <= diff) - { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(pTarget, SPELL_AMPLIFY_DAMAGE); - AmplifyDamageTimer = urand(20000,30000); - } else AmplifyDamageTimer -= diff; - } + if (AmplifyDamageTimer <= diff) + { + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + DoCast(pTarget, SPELL_AMPLIFY_DAMAGE); + AmplifyDamageTimer = urand(20000,30000); + } else AmplifyDamageTimer -= diff; + } - //Time for global and double timers - if (InfernalTimer <= diff) - { - SummonInfernal(diff); - InfernalTimer = phase == 3 ? 14500 : 44500; // 15 secs in phase 3, 45 otherwise - } else InfernalTimer -= diff; + //Time for global and double timers + if (InfernalTimer <= diff) + { + SummonInfernal(diff); + InfernalTimer = phase == 3 ? 14500 : 44500; // 15 secs in phase 3, 45 otherwise + } else InfernalTimer -= diff; - if (ShadowNovaTimer <= diff) - { - DoCast(me->getVictim(), SPELL_SHADOWNOVA); - ShadowNovaTimer = phase == 3 ? 31000 : uint32(-1); - } else ShadowNovaTimer -= diff; + if (ShadowNovaTimer <= diff) + { + DoCast(me->getVictim(), SPELL_SHADOWNOVA); + ShadowNovaTimer = phase == 3 ? 31000 : uint32(-1); + } else ShadowNovaTimer -= diff; - if (phase != 2) - { - if (SWPainTimer <= diff) + if (phase != 2) { - Unit *pTarget = NULL; - if (phase == 1) - pTarget = me->getVictim(); // the tank - else // anyone but the tank - pTarget = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true); + if (SWPainTimer <= diff) + { + Unit *pTarget = NULL; + if (phase == 1) + pTarget = me->getVictim(); // the tank + else // anyone but the tank + pTarget = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true); - if (pTarget) - DoCast(pTarget, SPELL_SW_PAIN); + if (pTarget) + DoCast(pTarget, SPELL_SW_PAIN); - SWPainTimer = 20000; - } else SWPainTimer -= diff; - } + SWPainTimer = 20000; + } else SWPainTimer -= diff; + } - if (phase != 3) - { - if (EnfeebleTimer <= diff) + if (phase != 3) { - EnfeebleHealthEffect(); - EnfeebleTimer = 30000; - ShadowNovaTimer = 5000; - EnfeebleResetTimer = 9000; - } else EnfeebleTimer -= diff; - } + if (EnfeebleTimer <= diff) + { + EnfeebleHealthEffect(); + EnfeebleTimer = 30000; + ShadowNovaTimer = 5000; + EnfeebleResetTimer = 9000; + } else EnfeebleTimer -= diff; + } - if (phase == 2) - DoMeleeAttacksIfReady(); - else - DoMeleeAttackIfReady(); - } + if (phase == 2) + DoMeleeAttacksIfReady(); + else + DoMeleeAttackIfReady(); + } - void DoMeleeAttacksIfReady() - { - if (me->IsWithinMeleeRange(me->getVictim()) && !me->IsNonMeleeSpellCasted(false)) + void DoMeleeAttacksIfReady() { - //Check for base attack - if (me->isAttackReady() && me->getVictim()) - { - me->AttackerStateUpdate(me->getVictim()); - me->resetAttackTimer(); - } - //Check for offhand attack - if (me->isAttackReady(OFF_ATTACK) && me->getVictim()) + if (me->IsWithinMeleeRange(me->getVictim()) && !me->IsNonMeleeSpellCasted(false)) { - me->AttackerStateUpdate(me->getVictim(), OFF_ATTACK); - me->resetAttackTimer(OFF_ATTACK); + //Check for base attack + if (me->isAttackReady() && me->getVictim()) + { + me->AttackerStateUpdate(me->getVictim()); + me->resetAttackTimer(); + } + //Check for offhand attack + if (me->isAttackReady(OFF_ATTACK) && me->getVictim()) + { + me->AttackerStateUpdate(me->getVictim(), OFF_ATTACK); + me->resetAttackTimer(OFF_ATTACK); + } } } - } - void Cleanup(Creature *infernal, InfernalPoint *point) - { - for (std::vector<uint64>::iterator itr = infernals.begin(); itr!= infernals.end(); ++itr) - if (*itr == infernal->GetGUID()) + void Cleanup(Creature *infernal, InfernalPoint *point) { - infernals.erase(itr); - break; + for (std::vector<uint64>::iterator itr = infernals.begin(); itr!= infernals.end(); ++itr) + if (*itr == infernal->GetGUID()) + { + infernals.erase(itr); + break; + } + + positions.push_back(point); } + }; - positions.push_back(point); - } }; -void netherspite_infernalAI::Cleanup() -{ - Unit *pMalchezaar = Unit::GetUnit(*me, malchezaar); - - if (pMalchezaar && pMalchezaar->isAlive()) - CAST_AI(boss_malchezaarAI, CAST_CRE(pMalchezaar)->AI())->Cleanup(me, point); -} - -CreatureAI* GetAI_netherspite_infernal(Creature* pCreature) -{ - return new netherspite_infernalAI (pCreature); -} - -CreatureAI* GetAI_boss_malchezaar(Creature* pCreature) -{ - return new boss_malchezaarAI (pCreature); -} - void AddSC_boss_malchezaar() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_malchezaar"; - newscript->GetAI = &GetAI_boss_malchezaar; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "netherspite_infernal"; - newscript->GetAI = &GetAI_netherspite_infernal; - newscript->RegisterSelf(); + new boss_malchezaar(); + new netherspite_infernal(); } - diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp index 37ea79fefbe..d3d61abb0a0 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp @@ -80,492 +80,497 @@ enum SuperSpell SUPER_BLIZZARD, SUPER_AE, }; - -struct boss_aranAI : public ScriptedAI +
class boss_shade_of_aran : public CreatureScript { - boss_aranAI(Creature *c) : ScriptedAI(c) +public: + boss_shade_of_aran() : CreatureScript("boss_shade_of_aran") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_aranAI (pCreature); } - ScriptedInstance* pInstance; - - uint32 SecondarySpellTimer; - uint32 NormalCastTimer; - uint32 SuperCastTimer; - uint32 BerserkTimer; - uint32 CloseDoorTimer; // Don't close the door right on aggro in case some people are still entering. + struct boss_aranAI : public ScriptedAI + { + boss_aranAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } - uint8 LastSuperSpell; + InstanceScript* pInstance; - uint32 FlameWreathTimer; - uint32 FlameWreathCheckTime; - uint64 FlameWreathTarget[3]; - float FWTargPosX[3]; - float FWTargPosY[3]; + uint32 SecondarySpellTimer; + uint32 NormalCastTimer; + uint32 SuperCastTimer; + uint32 BerserkTimer; + uint32 CloseDoorTimer; // Don't close the door right on aggro in case some people are still entering. - uint32 CurrentNormalSpell; - uint32 ArcaneCooldown; - uint32 FireCooldown; - uint32 FrostCooldown; + uint8 LastSuperSpell; - uint32 DrinkInterruptTimer; + uint32 FlameWreathTimer; + uint32 FlameWreathCheckTime; + uint64 FlameWreathTarget[3]; + float FWTargPosX[3]; + float FWTargPosY[3]; - bool ElementalsSpawned; - bool Drinking; - bool DrinkInturrupted; + uint32 CurrentNormalSpell; + uint32 ArcaneCooldown; + uint32 FireCooldown; + uint32 FrostCooldown; - void Reset() - { - SecondarySpellTimer = 5000; - NormalCastTimer = 0; - SuperCastTimer = 35000; - BerserkTimer = 720000; - CloseDoorTimer = 15000; + uint32 DrinkInterruptTimer; - LastSuperSpell = rand()%3; + bool ElementalsSpawned; + bool Drinking; + bool DrinkInturrupted; - FlameWreathTimer = 0; - FlameWreathCheckTime = 0; + void Reset() + { + SecondarySpellTimer = 5000; + NormalCastTimer = 0; + SuperCastTimer = 35000; + BerserkTimer = 720000; + CloseDoorTimer = 15000; - CurrentNormalSpell = 0; - ArcaneCooldown = 0; - FireCooldown = 0; - FrostCooldown = 0; + LastSuperSpell = rand()%3; - DrinkInterruptTimer = 10000; + FlameWreathTimer = 0; + FlameWreathCheckTime = 0; - ElementalsSpawned = false; - Drinking = false; - DrinkInturrupted = false; + CurrentNormalSpell = 0; + ArcaneCooldown = 0; + FireCooldown = 0; + FrostCooldown = 0; - if (pInstance) - { - // Not in progress - pInstance->SetData(TYPE_ARAN, NOT_STARTED); - pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_LIBRARY_DOOR), true); - } - } + DrinkInterruptTimer = 10000; - void KilledUnit(Unit * /*victim*/) - { - DoScriptText(RAND(SAY_KILL1,SAY_KILL2), me); - } + ElementalsSpawned = false; + Drinking = false; + DrinkInturrupted = false; - void JustDied(Unit * /*victim*/) - { - DoScriptText(SAY_DEATH, me); + if (pInstance) + { + // Not in progress + pInstance->SetData(TYPE_ARAN, NOT_STARTED); + pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_LIBRARY_DOOR), true); + } + } - if (pInstance) + void KilledUnit(Unit * /*victim*/) { - pInstance->SetData(TYPE_ARAN, DONE); - pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_LIBRARY_DOOR), true); + DoScriptText(RAND(SAY_KILL1,SAY_KILL2), me); } - } - void EnterCombat(Unit * /*who*/) - { - DoScriptText(RAND(SAY_AGGRO1,SAY_AGGRO2,SAY_AGGRO3), me); - - if (pInstance) + void JustDied(Unit * /*victim*/) { - pInstance->SetData(TYPE_ARAN, IN_PROGRESS); - pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_LIBRARY_DOOR), false); + DoScriptText(SAY_DEATH, me); + + if (pInstance) + { + pInstance->SetData(TYPE_ARAN, DONE); + pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_LIBRARY_DOOR), true); + } } - } - void FlameWreathEffect() - { - std::vector<Unit*> targets; - std::list<HostileReference *> t_list = me->getThreatManager().getThreatList(); + void EnterCombat(Unit * /*who*/) + { + DoScriptText(RAND(SAY_AGGRO1,SAY_AGGRO2,SAY_AGGRO3), me); - if (!t_list.size()) - return; + if (pInstance) + { + pInstance->SetData(TYPE_ARAN, IN_PROGRESS); + pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_LIBRARY_DOOR), false); + } + } - //store the threat list in a different container - for (std::list<HostileReference *>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) + void FlameWreathEffect() { - Unit *pTarget = Unit::GetUnit(*me, (*itr)->getUnitGuid()); - //only on alive players - if (pTarget && pTarget->isAlive() && pTarget->GetTypeId() == TYPEID_PLAYER) - targets.push_back(pTarget); - } + std::vector<Unit*> targets; + std::list<HostileReference *> t_list = me->getThreatManager().getThreatList(); - //cut down to size if we have more than 3 targets - while (targets.size() > 3) - targets.erase(targets.begin()+rand()%targets.size()); + if (!t_list.size()) + return; - uint32 i = 0; - for (std::vector<Unit*>::const_iterator itr = targets.begin(); itr!= targets.end(); ++itr) - { - if (*itr) + //store the threat list in a different container + for (std::list<HostileReference *>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) { - FlameWreathTarget[i] = (*itr)->GetGUID(); - FWTargPosX[i] = (*itr)->GetPositionX(); - FWTargPosY[i] = (*itr)->GetPositionY(); - DoCast((*itr), SPELL_FLAME_WREATH, true); - ++i; + Unit *pTarget = Unit::GetUnit(*me, (*itr)->getUnitGuid()); + //only on alive players + if (pTarget && pTarget->isAlive() && pTarget->GetTypeId() == TYPEID_PLAYER) + targets.push_back(pTarget); } - } - } - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + //cut down to size if we have more than 3 targets + while (targets.size() > 3) + targets.erase(targets.begin()+rand()%targets.size()); - if (CloseDoorTimer) - { - if (CloseDoorTimer <= diff) + uint32 i = 0; + for (std::vector<Unit*>::const_iterator itr = targets.begin(); itr!= targets.end(); ++itr) { - if (pInstance) + if (*itr) { - pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_LIBRARY_DOOR), false); - CloseDoorTimer = 0; + FlameWreathTarget[i] = (*itr)->GetGUID(); + FWTargPosX[i] = (*itr)->GetPositionX(); + FWTargPosY[i] = (*itr)->GetPositionY(); + DoCast((*itr), SPELL_FLAME_WREATH, true); + ++i; } - } else CloseDoorTimer -= diff; - } - - //Cooldowns for casts - if (ArcaneCooldown) - { - if (ArcaneCooldown >= diff) - ArcaneCooldown -= diff; - else ArcaneCooldown = 0; + } } - if (FireCooldown) + void UpdateAI(const uint32 diff) { - if (FireCooldown >= diff) - FireCooldown -= diff; - else FireCooldown = 0; - } + if (!UpdateVictim()) + return; - if (FrostCooldown) - { - if (FrostCooldown >= diff) - FrostCooldown -= diff; - else FrostCooldown = 0; - } + if (CloseDoorTimer) + { + if (CloseDoorTimer <= diff) + { + if (pInstance) + { + pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_LIBRARY_DOOR), false); + CloseDoorTimer = 0; + } + } else CloseDoorTimer -= diff; + } - if (!Drinking && me->GetMaxPower(POWER_MANA) && (me->GetPower(POWER_MANA)*100 / me->GetMaxPower(POWER_MANA)) < 20) - { - Drinking = true; - me->InterruptNonMeleeSpells(false); + //Cooldowns for casts + if (ArcaneCooldown) + { + if (ArcaneCooldown >= diff) + ArcaneCooldown -= diff; + else ArcaneCooldown = 0; + } - DoScriptText(SAY_DRINK, me); + if (FireCooldown) + { + if (FireCooldown >= diff) + FireCooldown -= diff; + else FireCooldown = 0; + } - if (!DrinkInturrupted) + if (FrostCooldown) { - DoCast(me, SPELL_MASS_POLY, true); - DoCast(me, SPELL_CONJURE, false); - DoCast(me, SPELL_DRINK, false); - me->SetStandState(UNIT_STAND_STATE_SIT); - DrinkInterruptTimer = 10000; + if (FrostCooldown >= diff) + FrostCooldown -= diff; + else FrostCooldown = 0; } - } - //Drink Interrupt - if (Drinking && DrinkInturrupted) - { - Drinking = false; - me->RemoveAurasDueToSpell(SPELL_DRINK); - me->SetStandState(UNIT_STAND_STATE_STAND); - me->SetPower(POWER_MANA, me->GetMaxPower(POWER_MANA)-32000); - DoCast(me, SPELL_POTION, false); - } + if (!Drinking && me->GetMaxPower(POWER_MANA) && (me->GetPower(POWER_MANA)*100 / me->GetMaxPower(POWER_MANA)) < 20) + { + Drinking = true; + me->InterruptNonMeleeSpells(false); - //Drink Interrupt Timer - if (Drinking && !DrinkInturrupted) - if (DrinkInterruptTimer >= diff) - DrinkInterruptTimer -= diff; - else - { - me->SetStandState(UNIT_STAND_STATE_STAND); - DoCast(me, SPELL_POTION, true); - DoCast(me, SPELL_AOE_PYROBLAST, false); - DrinkInturrupted = true; - Drinking = false; - } + DoScriptText(SAY_DRINK, me); - //Don't execute any more code if we are drinking - if (Drinking) - return; + if (!DrinkInturrupted) + { + DoCast(me, SPELL_MASS_POLY, true); + DoCast(me, SPELL_CONJURE, false); + DoCast(me, SPELL_DRINK, false); + me->SetStandState(UNIT_STAND_STATE_SIT); + DrinkInterruptTimer = 10000; + } + } - //Normal casts - if (NormalCastTimer <= diff) - { - if (!me->IsNonMeleeSpellCasted(false)) + //Drink Interrupt + if (Drinking && DrinkInturrupted) { - Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); - if (!pTarget) - return; + Drinking = false; + me->RemoveAurasDueToSpell(SPELL_DRINK); + me->SetStandState(UNIT_STAND_STATE_STAND); + me->SetPower(POWER_MANA, me->GetMaxPower(POWER_MANA)-32000); + DoCast(me, SPELL_POTION, false); + } - uint32 Spells[3]; - uint8 AvailableSpells = 0; + //Drink Interrupt Timer + if (Drinking && !DrinkInturrupted) + if (DrinkInterruptTimer >= diff) + DrinkInterruptTimer -= diff; + else + { + me->SetStandState(UNIT_STAND_STATE_STAND); + DoCast(me, SPELL_POTION, true); + DoCast(me, SPELL_AOE_PYROBLAST, false); + DrinkInturrupted = true; + Drinking = false; + } - //Check for what spells are not on cooldown - if (!ArcaneCooldown) - { - Spells[AvailableSpells] = SPELL_ARCMISSLE; - ++AvailableSpells; - } - if (!FireCooldown) + //Don't execute any more code if we are drinking + if (Drinking) + return; + + //Normal casts + if (NormalCastTimer <= diff) + { + if (!me->IsNonMeleeSpellCasted(false)) { - Spells[AvailableSpells] = SPELL_FIREBALL; - ++AvailableSpells; + Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); + if (!pTarget) + return; + + uint32 Spells[3]; + uint8 AvailableSpells = 0; + + //Check for what spells are not on cooldown + if (!ArcaneCooldown) + { + Spells[AvailableSpells] = SPELL_ARCMISSLE; + ++AvailableSpells; + } + if (!FireCooldown) + { + Spells[AvailableSpells] = SPELL_FIREBALL; + ++AvailableSpells; + } + if (!FrostCooldown) + { + Spells[AvailableSpells] = SPELL_FROSTBOLT; + ++AvailableSpells; + } + + //If no available spells wait 1 second and try again + if (AvailableSpells) + { + CurrentNormalSpell = Spells[rand() % AvailableSpells]; + DoCast(pTarget, CurrentNormalSpell); + } } - if (!FrostCooldown) + NormalCastTimer = 1000; + } else NormalCastTimer -= diff; + + if (SecondarySpellTimer <= diff) + { + switch (urand(0,1)) { - Spells[AvailableSpells] = SPELL_FROSTBOLT; - ++AvailableSpells; + case 0: + DoCast(me, SPELL_AOE_CS); + break; + case 1: + if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + DoCast(pTarget, SPELL_CHAINSOFICE); + break; } + SecondarySpellTimer = urand(5000,20000); + } else SecondarySpellTimer -= diff; + + if (SuperCastTimer <= diff) + { + uint8 Available[2]; - //If no available spells wait 1 second and try again - if (AvailableSpells) + switch (LastSuperSpell) { - CurrentNormalSpell = Spells[rand() % AvailableSpells]; - DoCast(pTarget, CurrentNormalSpell); + case SUPER_AE: + Available[0] = SUPER_FLAME; + Available[1] = SUPER_BLIZZARD; + break; + case SUPER_FLAME: + Available[0] = SUPER_AE; + Available[1] = SUPER_BLIZZARD; + break; + case SUPER_BLIZZARD: + Available[0] = SUPER_FLAME; + Available[1] = SUPER_AE; + break; } - } - NormalCastTimer = 1000; - } else NormalCastTimer -= diff; - if (SecondarySpellTimer <= diff) - { - switch (urand(0,1)) - { - case 0: - DoCast(me, SPELL_AOE_CS); - break; - case 1: - if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(pTarget, SPELL_CHAINSOFICE); - break; - } - SecondarySpellTimer = urand(5000,20000); - } else SecondarySpellTimer -= diff; + LastSuperSpell = Available[urand(0,1)]; - if (SuperCastTimer <= diff) - { - uint8 Available[2]; + switch (LastSuperSpell) + { + case SUPER_AE: + DoScriptText(RAND(SAY_EXPLOSION1,SAY_EXPLOSION2), me); - switch (LastSuperSpell) - { - case SUPER_AE: - Available[0] = SUPER_FLAME; - Available[1] = SUPER_BLIZZARD; - break; - case SUPER_FLAME: - Available[0] = SUPER_AE; - Available[1] = SUPER_BLIZZARD; - break; - case SUPER_BLIZZARD: - Available[0] = SUPER_FLAME; - Available[1] = SUPER_AE; - break; - } + DoCast(me, SPELL_BLINK_CENTER, true); + DoCast(me, SPELL_PLAYERPULL, true); + DoCast(me, SPELL_MASSSLOW, true); + DoCast(me, SPELL_AEXPLOSION, false); + break; - LastSuperSpell = Available[urand(0,1)]; + case SUPER_FLAME: + DoScriptText(RAND(SAY_FLAMEWREATH1,SAY_FLAMEWREATH2), me); - switch (LastSuperSpell) - { - case SUPER_AE: - DoScriptText(RAND(SAY_EXPLOSION1,SAY_EXPLOSION2), me); + FlameWreathTimer = 20000; + FlameWreathCheckTime = 500; - DoCast(me, SPELL_BLINK_CENTER, true); - DoCast(me, SPELL_PLAYERPULL, true); - DoCast(me, SPELL_MASSSLOW, true); - DoCast(me, SPELL_AEXPLOSION, false); - break; + FlameWreathTarget[0] = 0; + FlameWreathTarget[1] = 0; + FlameWreathTarget[2] = 0; - case SUPER_FLAME: - DoScriptText(RAND(SAY_FLAMEWREATH1,SAY_FLAMEWREATH2), me); + FlameWreathEffect(); + break; - FlameWreathTimer = 20000; - FlameWreathCheckTime = 500; + case SUPER_BLIZZARD: + DoScriptText(RAND(SAY_BLIZZARD1,SAY_BLIZZARD2), me); - FlameWreathTarget[0] = 0; - FlameWreathTarget[1] = 0; - FlameWreathTarget[2] = 0; + if (Creature* pSpawn = me->SummonCreature(CREATURE_ARAN_BLIZZARD, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 25000)) + { + pSpawn->setFaction(me->getFaction()); + pSpawn->CastSpell(pSpawn, SPELL_CIRCULAR_BLIZZARD, false); + } + break; + } - FlameWreathEffect(); - break; + SuperCastTimer = urand(35000,40000); + } else SuperCastTimer -= diff; - case SUPER_BLIZZARD: - DoScriptText(RAND(SAY_BLIZZARD1,SAY_BLIZZARD2), me); + if (!ElementalsSpawned && me->GetHealth()*100 / me->GetMaxHealth() < 40) + { + ElementalsSpawned = true; - if (Creature* pSpawn = me->SummonCreature(CREATURE_ARAN_BLIZZARD, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 25000)) + for (uint32 i = 0; i < 4; ++i) + { + if (Creature* pUnit = me->SummonCreature(CREATURE_WATER_ELEMENTAL, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 90000)) { - pSpawn->setFaction(me->getFaction()); - pSpawn->CastSpell(pSpawn, SPELL_CIRCULAR_BLIZZARD, false); + pUnit->Attack(me->getVictim(), true); + pUnit->setFaction(me->getFaction()); } - break; - } - - SuperCastTimer = urand(35000,40000); - } else SuperCastTimer -= diff; + } - if (!ElementalsSpawned && me->GetHealth()*100 / me->GetMaxHealth() < 40) - { - ElementalsSpawned = true; + DoScriptText(SAY_ELEMENTALS, me); + } - for (uint32 i = 0; i < 4; ++i) + if (BerserkTimer <= diff) { - if (Creature* pUnit = me->SummonCreature(CREATURE_WATER_ELEMENTAL, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 90000)) + for (uint32 i = 0; i < 5; ++i) { - pUnit->Attack(me->getVictim(), true); - pUnit->setFaction(me->getFaction()); + if (Creature* pUnit = me->SummonCreature(CREATURE_SHADOW_OF_ARAN, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000)) + { + pUnit->Attack(me->getVictim(), true); + pUnit->setFaction(me->getFaction()); + } } - } - DoScriptText(SAY_ELEMENTALS, me); - } + DoScriptText(SAY_TIMEOVER, me); - if (BerserkTimer <= diff) - { - for (uint32 i = 0; i < 5; ++i) + BerserkTimer = 60000; + } else BerserkTimer -= diff; + + //Flame Wreath check + if (FlameWreathTimer) { - if (Creature* pUnit = me->SummonCreature(CREATURE_SHADOW_OF_ARAN, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000)) + if (FlameWreathTimer >= diff) + FlameWreathTimer -= diff; + else FlameWreathTimer = 0; + + if (FlameWreathCheckTime <= diff) { - pUnit->Attack(me->getVictim(), true); - pUnit->setFaction(me->getFaction()); - } + for (uint8 i = 0; i < 3; ++i) + { + if (!FlameWreathTarget[i]) + continue; + + Unit* pUnit = Unit::GetUnit(*me, FlameWreathTarget[i]); + if (pUnit && !pUnit->IsWithinDist2d(FWTargPosX[i], FWTargPosY[i], 3)) + { + pUnit->CastSpell(pUnit, 20476, true, 0, 0, me->GetGUID()); + pUnit->CastSpell(pUnit, 11027, true); + FlameWreathTarget[i] = 0; + } + } + FlameWreathCheckTime = 500; + } else FlameWreathCheckTime -= diff; } - DoScriptText(SAY_TIMEOVER, me); + if (ArcaneCooldown && FireCooldown && FrostCooldown) + DoMeleeAttackIfReady(); + } - BerserkTimer = 60000; - } else BerserkTimer -= diff; + void DamageTaken(Unit* /*pAttacker*/, uint32 &damage) + { + if (!DrinkInturrupted && Drinking && damage) + DrinkInturrupted = true; + } - //Flame Wreath check - if (FlameWreathTimer) + void SpellHit(Unit* /*pAttacker*/, const SpellEntry* Spell) { - if (FlameWreathTimer >= diff) - FlameWreathTimer -= diff; - else FlameWreathTimer = 0; + //We only care about interrupt effects and only if they are durring a spell currently being casted + if ((Spell->Effect[0] != SPELL_EFFECT_INTERRUPT_CAST && + Spell->Effect[1] != SPELL_EFFECT_INTERRUPT_CAST && + Spell->Effect[2] != SPELL_EFFECT_INTERRUPT_CAST) || !me->IsNonMeleeSpellCasted(false)) + return; - if (FlameWreathCheckTime <= diff) - { - for (uint8 i = 0; i < 3; ++i) - { - if (!FlameWreathTarget[i]) - continue; + //Interrupt effect + me->InterruptNonMeleeSpells(false); - Unit* pUnit = Unit::GetUnit(*me, FlameWreathTarget[i]); - if (pUnit && !pUnit->IsWithinDist2d(FWTargPosX[i], FWTargPosY[i], 3)) - { - pUnit->CastSpell(pUnit, 20476, true, 0, 0, me->GetGUID()); - pUnit->CastSpell(pUnit, 11027, true); - FlameWreathTarget[i] = 0; - } - } - FlameWreathCheckTime = 500; - } else FlameWreathCheckTime -= diff; + //Normally we would set the cooldown equal to the spell duration + //but we do not have access to the DurationStore + + switch (CurrentNormalSpell) + { + case SPELL_ARCMISSLE: ArcaneCooldown = 5000; break; + case SPELL_FIREBALL: FireCooldown = 5000; break; + case SPELL_FROSTBOLT: FrostCooldown = 5000; break; + } } + }; - if (ArcaneCooldown && FireCooldown && FrostCooldown) - DoMeleeAttackIfReady(); - } +}; +
class mob_aran_elemental : public CreatureScript +{ +public: + mob_aran_elemental() : CreatureScript("mob_aran_elemental") { } - void DamageTaken(Unit* /*pAttacker*/, uint32 &damage) + CreatureAI* GetAI(Creature* pCreature) const { - if (!DrinkInturrupted && Drinking && damage) - DrinkInturrupted = true; + return new water_elementalAI (pCreature); } - void SpellHit(Unit* /*pAttacker*/, const SpellEntry* Spell) + struct water_elementalAI : public ScriptedAI { - //We only care about interrupt effects and only if they are durring a spell currently being casted - if ((Spell->Effect[0] != SPELL_EFFECT_INTERRUPT_CAST && - Spell->Effect[1] != SPELL_EFFECT_INTERRUPT_CAST && - Spell->Effect[2] != SPELL_EFFECT_INTERRUPT_CAST) || !me->IsNonMeleeSpellCasted(false)) - return; + water_elementalAI(Creature *c) : ScriptedAI(c) {} - //Interrupt effect - me->InterruptNonMeleeSpells(false); + uint32 CastTimer; - //Normally we would set the cooldown equal to the spell duration - //but we do not have access to the DurationStore - - switch (CurrentNormalSpell) + void Reset() { - case SPELL_ARCMISSLE: ArcaneCooldown = 5000; break; - case SPELL_FIREBALL: FireCooldown = 5000; break; - case SPELL_FROSTBOLT: FrostCooldown = 5000; break; + CastTimer = 2000 + (rand()%3000); } - } -}; - -struct water_elementalAI : public ScriptedAI -{ - water_elementalAI(Creature *c) : ScriptedAI(c) {} - uint32 CastTimer; + void EnterCombat(Unit* /*who*/) {} - void Reset() - { - CastTimer = 2000 + (rand()%3000); - } - - void EnterCombat(Unit* /*who*/) {} + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + if (CastTimer <= diff) + { + DoCast(me->getVictim(), SPELL_WATERBOLT); + CastTimer = urand(2000,5000); + } else CastTimer -= diff; + } + }; - if (CastTimer <= diff) - { - DoCast(me->getVictim(), SPELL_WATERBOLT); - CastTimer = urand(2000,5000); - } else CastTimer -= diff; - } }; -CreatureAI* GetAI_boss_aran(Creature* pCreature) +// CONVERT TO ACID
class mob_shadow_of_aran : public CreatureScript { - return new boss_aranAI (pCreature); -} +public: + mob_shadow_of_aran() : CreatureScript("mob_shadow_of_aran") { } -CreatureAI* GetAI_water_elemental(Creature* pCreature) -{ - return new water_elementalAI (pCreature); -} + CreatureAI* GetAI(Creature* pCreature) const + { + sLog.outString("TSCR: Convert simpleAI script for Creature Entry %u to ACID", pCreature->GetEntry()); + SimpleAI* ai = new SimpleAI (pCreature); -// CONVERT TO ACID -CreatureAI* GetAI_shadow_of_aran(Creature* pCreature) -{ - sLog.outString("TSCR: Convert simpleAI script for Creature Entry %u to ACID", pCreature->GetEntry()); - SimpleAI* ai = new SimpleAI (pCreature); + ai->Spell[0].Enabled = true; + ai->Spell[0].Spell_Id = SPELL_SHADOW_PYRO; + ai->Spell[0].Cooldown = 5000; + ai->Spell[0].First_Cast = 1000; + ai->Spell[0].Cast_Target_Type = CAST_HOSTILE_TARGET; - ai->Spell[0].Enabled = true; - ai->Spell[0].Spell_Id = SPELL_SHADOW_PYRO; - ai->Spell[0].Cooldown = 5000; - ai->Spell[0].First_Cast = 1000; - ai->Spell[0].Cast_Target_Type = CAST_HOSTILE_TARGET; + ai->EnterEvadeMode(); - ai->EnterEvadeMode(); + return ai; + } - return ai; -} +}; void AddSC_boss_shade_of_aran() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_shade_of_aran"; - newscript->GetAI = &GetAI_boss_aran; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_shadow_of_aran"; - newscript->GetAI = &GetAI_shadow_of_aran; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_aran_elemental"; - newscript->GetAI = &GetAI_water_elemental; - newscript->RegisterSelf(); + new boss_shade_of_aran(); + new mob_shadow_of_aran(); + new mob_aran_elemental(); } - diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp index 039b517bd9b..cd8db6c5cfd 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp @@ -55,365 +55,374 @@ EndScriptData */ #define CREATURE_FIENDISHIMP 17267 #define CREATURE_PORTAL 17265 #define CREATURE_KILREK 17229 - -struct mob_kilrekAI : public ScriptedAI +
class mob_kilrek : public CreatureScript { - mob_kilrekAI(Creature *c) : ScriptedAI(c) +public: + mob_kilrek() : CreatureScript("mob_kilrek") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new mob_kilrekAI (pCreature); } - ScriptedInstance* pInstance; + struct mob_kilrekAI : public ScriptedAI + { + mob_kilrekAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } - uint64 TerestianGUID; + InstanceScript* pInstance; - uint32 AmplifyTimer; + uint64 TerestianGUID; - void Reset() - { - TerestianGUID = 0; - AmplifyTimer = 2000; - } + uint32 AmplifyTimer; - void EnterCombat(Unit * /*who*/) - { - if (!pInstance) + void Reset() { - ERROR_INST_DATA(me); - return; + TerestianGUID = 0; + AmplifyTimer = 2000; } - } - void JustDied(Unit* /*Killer*/) - { - if (pInstance) + void EnterCombat(Unit * /*who*/) { - uint64 TerestianGUID = pInstance->GetData64(DATA_TERESTIAN); - if (TerestianGUID) + if (!pInstance) { - Unit* Terestian = Unit::GetUnit((*me), TerestianGUID); - if (Terestian && Terestian->isAlive()) - DoCast(Terestian, SPELL_BROKEN_PACT, true); + ERROR_INST_DATA(me); + return; } - } else ERROR_INST_DATA(me); - } + } - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + void JustDied(Unit* /*Killer*/) + { + if (pInstance) + { + uint64 TerestianGUID = pInstance->GetData64(DATA_TERESTIAN); + if (TerestianGUID) + { + Unit* Terestian = Unit::GetUnit((*me), TerestianGUID); + if (Terestian && Terestian->isAlive()) + DoCast(Terestian, SPELL_BROKEN_PACT, true); + } + } else ERROR_INST_DATA(me); + } - if (AmplifyTimer <= diff) + void UpdateAI(const uint32 diff) { - me->InterruptNonMeleeSpells(false); - DoCast(me->getVictim(), SPELL_AMPLIFY_FLAMES); + //Return since we have no target + if (!UpdateVictim()) + return; - AmplifyTimer = urand(10000,20000); - } else AmplifyTimer -= diff; + if (AmplifyTimer <= diff) + { + me->InterruptNonMeleeSpells(false); + DoCast(me->getVictim(), SPELL_AMPLIFY_FLAMES); - DoMeleeAttackIfReady(); - } -}; + AmplifyTimer = urand(10000,20000); + } else AmplifyTimer -= diff; -struct mob_demon_chainAI : public ScriptedAI -{ - mob_demon_chainAI(Creature *c) : ScriptedAI(c) {} + DoMeleeAttackIfReady(); + } + }; - uint64 SacrificeGUID; +}; +
class mob_demon_chain : public CreatureScript +{ +public: + mob_demon_chain() : CreatureScript("mob_demon_chain") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - SacrificeGUID = 0; + return new mob_demon_chainAI(pCreature); } - void EnterCombat(Unit* /*who*/) {} - void AttackStart(Unit* /*who*/) {} - void MoveInLineOfSight(Unit* /*who*/) {} - - void JustDied(Unit * /*killer*/) + struct mob_demon_chainAI : public ScriptedAI { - if (SacrificeGUID) - { - Unit* Sacrifice = Unit::GetUnit((*me),SacrificeGUID); - if (Sacrifice) - Sacrifice->RemoveAurasDueToSpell(SPELL_SACRIFICE); - } - } -}; + mob_demon_chainAI(Creature *c) : ScriptedAI(c) {} -struct mob_fiendish_portalAI : public PassiveAI -{ - mob_fiendish_portalAI(Creature *c) : PassiveAI(c),summons(me){} + uint64 SacrificeGUID; - SummonList summons; + void Reset() + { + SacrificeGUID = 0; + } - void Reset() - { - summons.DespawnAll(); - } + void EnterCombat(Unit* /*who*/) {} + void AttackStart(Unit* /*who*/) {} + void MoveInLineOfSight(Unit* /*who*/) {} - void JustSummoned(Creature* summon) - { - summons.Summon(summon); - DoZoneInCombat(summon); - } + void JustDied(Unit * /*killer*/) + { + if (SacrificeGUID) + { + Unit* Sacrifice = Unit::GetUnit((*me),SacrificeGUID); + if (Sacrifice) + Sacrifice->RemoveAurasDueToSpell(SPELL_SACRIFICE); + } + } + }; - void DespawnAllImp() - { - summons.DespawnAll(); - } }; - -struct boss_terestianAI : public ScriptedAI +
class mob_fiendish_portal : public CreatureScript { - boss_terestianAI(Creature *c) : ScriptedAI(c) +public: + mob_fiendish_portal() : CreatureScript("mob_fiendish_portal") { } + + CreatureAI* GetAI(Creature* pCreature) const { - for (uint8 i = 0; i < 2; ++i) - PortalGUID[i] = 0; - pInstance = c->GetInstanceData(); + return new mob_fiendish_portalAI (pCreature); } - ScriptedInstance *pInstance; - - uint64 PortalGUID[2]; - uint8 PortalsCount; + struct mob_fiendish_portalAI : public PassiveAI + { + mob_fiendish_portalAI(Creature *c) : PassiveAI(c),summons(me){} - uint32 SacrificeTimer; - uint32 ShadowboltTimer; - uint32 SummonTimer; - uint32 BerserkTimer; + SummonList summons; - bool SummonedPortals; - bool Berserk; + void Reset() + { + summons.DespawnAll(); + } - void Reset() - { - for (uint8 i = 0; i < 2; ++i) + void JustSummoned(Creature* summon) { - if (PortalGUID[i]) - { - if (Creature* pPortal = Unit::GetCreature(*me, PortalGUID[i])) - { - CAST_AI(mob_fiendish_portalAI, pPortal->AI())->DespawnAllImp(); - pPortal->ForcedDespawn(); - } + summons.Summon(summon); + DoZoneInCombat(summon); + } - PortalGUID[i] = 0; - } + void DespawnAllImp() + { + summons.DespawnAll(); } + }; - PortalsCount = 0; - SacrificeTimer = 30000; - ShadowboltTimer = 5000; - SummonTimer = 10000; - BerserkTimer = 600000; +}; - SummonedPortals = false; - Berserk = false; +#define SPELL_FIREBOLT 30050 // Blasts a target for 181-209 Fire damage. +
class mob_fiendish_imp : public CreatureScript +{ +public: + mob_fiendish_imp() : CreatureScript("mob_fiendish_imp") { } - if (pInstance) - pInstance->SetData(TYPE_TERESTIAN, NOT_STARTED); + CreatureAI* GetAI(Creature* pCreature) const + { + return new mob_fiendish_impAI (pCreature); + } - me->RemoveAurasDueToSpell(SPELL_BROKEN_PACT); + struct mob_fiendish_impAI : public ScriptedAI + { + mob_fiendish_impAI(Creature *c) : ScriptedAI(c) {} - if (Minion* Kilrek = me->GetFirstMinion()) + uint32 FireboltTimer; + + void Reset() { - if (!Kilrek->isAlive()) - { - Kilrek->UnSummon(); - DoCast(me, SPELL_SUMMON_IMP, true); - } + FireboltTimer = 2000; + + me->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_FIRE, true); } - else DoCast(me, SPELL_SUMMON_IMP, true); - } - void EnterCombat(Unit* /*who*/) - { - DoScriptText(SAY_AGGRO, me); - } + void EnterCombat(Unit * /*who*/) {} - void JustSummoned(Creature* pSummoned) - { - if (pSummoned->GetEntry() == CREATURE_PORTAL) + void UpdateAI(const uint32 diff) { - PortalGUID[PortalsCount] = pSummoned->GetGUID(); - ++PortalsCount; + //Return since we have no target + if (!UpdateVictim()) + return; - if (pSummoned->GetUInt32Value(UNIT_CREATED_BY_SPELL) == SPELL_FIENDISH_PORTAL_1) + if (FireboltTimer <= diff) { - DoScriptText(RAND(SAY_SUMMON1,SAY_SUMMON2), me); - SummonedPortals = true; - } + DoCast(me->getVictim(), SPELL_FIREBOLT); + FireboltTimer = 2200; + } else FireboltTimer -= diff; + + DoMeleeAttackIfReady(); } - } + }; - void KilledUnit(Unit * /*victim*/) +}; +
class boss_terestian_illhoof : public CreatureScript +{ +public: + boss_terestian_illhoof() : CreatureScript("boss_terestian_illhoof") { } + + CreatureAI* GetAI(Creature* pCreature) const { - DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2), me); + return new boss_terestianAI (pCreature); } - void JustDied(Unit * /*killer*/) + struct boss_terestianAI : public ScriptedAI { - for (uint8 i = 0; i < 2; ++i) + boss_terestianAI(Creature *c) : ScriptedAI(c) { - if (PortalGUID[i]) - { - if (Creature* pPortal = Unit::GetCreature((*me), PortalGUID[i])) - pPortal->ForcedDespawn(); - + for (uint8 i = 0; i < 2; ++i) PortalGUID[i] = 0; - } + pInstance = c->GetInstanceScript(); } - DoScriptText(SAY_DEATH, me); + InstanceScript *pInstance; - if (pInstance) - pInstance->SetData(TYPE_TERESTIAN, DONE); - } + uint64 PortalGUID[2]; + uint8 PortalsCount; - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + uint32 SacrificeTimer; + uint32 ShadowboltTimer; + uint32 SummonTimer; + uint32 BerserkTimer; + + bool SummonedPortals; + bool Berserk; - if (SacrificeTimer <= diff) + void Reset() { - Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true); - if (pTarget && pTarget->isAlive()) + for (uint8 i = 0; i < 2; ++i) { - DoCast(pTarget, SPELL_SACRIFICE, true); - DoCast(pTarget, SPELL_SUMMON_DEMONCHAINS, true); - - if (Creature* Chains = me->FindNearestCreature(CREATURE_DEMONCHAINS, 5000)) + if (PortalGUID[i]) { - CAST_AI(mob_demon_chainAI, Chains->AI())->SacrificeGUID = pTarget->GetGUID(); - Chains->CastSpell(Chains, SPELL_DEMON_CHAINS, true); - DoScriptText(RAND(SAY_SACRIFICE1,SAY_SACRIFICE2), me); - SacrificeTimer = 30000; + if (Creature* pPortal = Unit::GetCreature(*me, PortalGUID[i])) + { + CAST_AI(mob_fiendish_portal::mob_fiendish_portalAI, pPortal->AI())->DespawnAllImp(); + pPortal->ForcedDespawn(); + } + + PortalGUID[i] = 0; } } - } else SacrificeTimer -= diff; - if (ShadowboltTimer <= diff) - { - DoCast(SelectUnit(SELECT_TARGET_TOPAGGRO, 0), SPELL_SHADOW_BOLT); - ShadowboltTimer = 10000; - } else ShadowboltTimer -= diff; + PortalsCount = 0; + SacrificeTimer = 30000; + ShadowboltTimer = 5000; + SummonTimer = 10000; + BerserkTimer = 600000; - if (SummonTimer <= diff) - { - if (!PortalGUID[0]) - DoCast(me->getVictim(), SPELL_FIENDISH_PORTAL, false); + SummonedPortals = false; + Berserk = false; - if (!PortalGUID[1]) - DoCast(me->getVictim(), SPELL_FIENDISH_PORTAL_1, false); + if (pInstance) + pInstance->SetData(TYPE_TERESTIAN, NOT_STARTED); - if (PortalGUID[0] && PortalGUID[1]) + me->RemoveAurasDueToSpell(SPELL_BROKEN_PACT); + + if (Minion* Kilrek = me->GetFirstMinion()) { - if (Creature* pPortal = Unit::GetCreature(*me, PortalGUID[urand(0,1)])) - pPortal->CastSpell(me->getVictim(), SPELL_SUMMON_FIENDISIMP, false); - SummonTimer = 5000; + if (!Kilrek->isAlive()) + { + Kilrek->UnSummon(); + DoCast(me, SPELL_SUMMON_IMP, true); + } } - } else SummonTimer -= diff; + else DoCast(me, SPELL_SUMMON_IMP, true); + } - if (!Berserk) + void EnterCombat(Unit* /*who*/) { - if (BerserkTimer <= diff) - { - DoCast(me, SPELL_BERSERK); - Berserk = true; - } else BerserkTimer -= diff; + DoScriptText(SAY_AGGRO, me); } - DoMeleeAttackIfReady(); - } -}; - -#define SPELL_FIREBOLT 30050 // Blasts a target for 181-209 Fire damage. + void JustSummoned(Creature* pSummoned) + { + if (pSummoned->GetEntry() == CREATURE_PORTAL) + { + PortalGUID[PortalsCount] = pSummoned->GetGUID(); + ++PortalsCount; -struct mob_fiendish_impAI : public ScriptedAI -{ - mob_fiendish_impAI(Creature *c) : ScriptedAI(c) {} + if (pSummoned->GetUInt32Value(UNIT_CREATED_BY_SPELL) == SPELL_FIENDISH_PORTAL_1) + { + DoScriptText(RAND(SAY_SUMMON1,SAY_SUMMON2), me); + SummonedPortals = true; + } + } + } - uint32 FireboltTimer; + void KilledUnit(Unit * /*victim*/) + { + DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2), me); + } - void Reset() - { - FireboltTimer = 2000; + void JustDied(Unit * /*killer*/) + { + for (uint8 i = 0; i < 2; ++i) + { + if (PortalGUID[i]) + { + if (Creature* pPortal = Unit::GetCreature((*me), PortalGUID[i])) + pPortal->ForcedDespawn(); - me->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_FIRE, true); - } + PortalGUID[i] = 0; + } + } - void EnterCombat(Unit * /*who*/) {} + DoScriptText(SAY_DEATH, me); - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + if (pInstance) + pInstance->SetData(TYPE_TERESTIAN, DONE); + } - if (FireboltTimer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_FIREBOLT); - FireboltTimer = 2200; - } else FireboltTimer -= diff; + if (!UpdateVictim()) + return; - DoMeleeAttackIfReady(); - } -}; + if (SacrificeTimer <= diff) + { + Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true); + if (pTarget && pTarget->isAlive()) + { + DoCast(pTarget, SPELL_SACRIFICE, true); + DoCast(pTarget, SPELL_SUMMON_DEMONCHAINS, true); + + if (Creature* Chains = me->FindNearestCreature(CREATURE_DEMONCHAINS, 5000)) + { + CAST_AI(mob_demon_chain::mob_demon_chainAI, Chains->AI())->SacrificeGUID = pTarget->GetGUID(); + Chains->CastSpell(Chains, SPELL_DEMON_CHAINS, true); + DoScriptText(RAND(SAY_SACRIFICE1,SAY_SACRIFICE2), me); + SacrificeTimer = 30000; + } + } + } else SacrificeTimer -= diff; -CreatureAI* GetAI_mob_kilrek(Creature* pCreature) -{ - return new mob_kilrekAI (pCreature); -} + if (ShadowboltTimer <= diff) + { + DoCast(SelectUnit(SELECT_TARGET_TOPAGGRO, 0), SPELL_SHADOW_BOLT); + ShadowboltTimer = 10000; + } else ShadowboltTimer -= diff; -CreatureAI* GetAI_mob_fiendish_imp(Creature* pCreature) -{ - return new mob_fiendish_impAI (pCreature); -} + if (SummonTimer <= diff) + { + if (!PortalGUID[0]) + DoCast(me->getVictim(), SPELL_FIENDISH_PORTAL, false); -CreatureAI* GetAI_mob_fiendish_portal(Creature* pCreature) -{ - return new mob_fiendish_portalAI (pCreature); -} + if (!PortalGUID[1]) + DoCast(me->getVictim(), SPELL_FIENDISH_PORTAL_1, false); -CreatureAI* GetAI_boss_terestian_illhoof(Creature* pCreature) -{ - return new boss_terestianAI (pCreature); -} + if (PortalGUID[0] && PortalGUID[1]) + { + if (Creature* pPortal = Unit::GetCreature(*me, PortalGUID[urand(0,1)])) + pPortal->CastSpell(me->getVictim(), SPELL_SUMMON_FIENDISIMP, false); + SummonTimer = 5000; + } + } else SummonTimer -= diff; -CreatureAI* GetAI_mob_demon_chain(Creature* pCreature) -{ - return new mob_demon_chainAI(pCreature); -} + if (!Berserk) + { + if (BerserkTimer <= diff) + { + DoCast(me, SPELL_BERSERK); + Berserk = true; + } else BerserkTimer -= diff; + } + + DoMeleeAttackIfReady(); + } + }; + +}; void AddSC_boss_terestian_illhoof() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_terestian_illhoof"; - newscript->GetAI = &GetAI_boss_terestian_illhoof; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_fiendish_imp"; - newscript->GetAI = &GetAI_mob_fiendish_imp; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name= "mob_fiendish_portal"; - newscript->GetAI = &GetAI_mob_fiendish_portal; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_kilrek"; - newscript->GetAI = &GetAI_mob_kilrek; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_demon_chain"; - newscript->GetAI = &GetAI_mob_demon_chain; - newscript->RegisterSelf(); + new boss_terestian_illhoof(); + new mob_fiendish_imp(); + new mob_fiendish_portal(); + new mob_kilrek(); + new mob_demon_chain(); } - diff --git a/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp b/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp index 6498e48069a..6c6d46880a2 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp @@ -88,7 +88,7 @@ EndScriptData */ #define CREATURE_CYCLONE 18412 #define CREATURE_CRONE 18168 -void SummonCroneIfReady(ScriptedInstance* pInstance, Creature* pCreature) +void SummonCroneIfReady(InstanceScript* pInstance, Creature* pCreature) { pInstance->SetData(DATA_OPERA_OZ_DEATHCOUNT, SPECIAL); // Increment DeathCount @@ -101,599 +101,648 @@ void SummonCroneIfReady(ScriptedInstance* pInstance, Creature* pCreature) } } }; - -struct boss_dorotheeAI : public ScriptedAI +
class boss_dorothee : public CreatureScript { - boss_dorotheeAI(Creature* c) : ScriptedAI(c) +public: + boss_dorothee() : CreatureScript("boss_dorothee") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_dorotheeAI(pCreature); } - ScriptedInstance* pInstance; + struct boss_dorotheeAI : public ScriptedAI + { + boss_dorotheeAI(Creature* c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } - uint32 AggroTimer; + InstanceScript* pInstance; - uint32 WaterBoltTimer; - uint32 FearTimer; - uint32 SummonTitoTimer; + uint32 AggroTimer; - bool SummonedTito; - bool TitoDied; + uint32 WaterBoltTimer; + uint32 FearTimer; + uint32 SummonTitoTimer; - void Reset() - { - AggroTimer = 500; + bool SummonedTito; + bool TitoDied; - WaterBoltTimer = 5000; - FearTimer = 15000; - SummonTitoTimer = 47500; + void Reset() + { + AggroTimer = 500; - SummonedTito = false; - TitoDied = false; - } + WaterBoltTimer = 5000; + FearTimer = 15000; + SummonTitoTimer = 47500; - void EnterCombat(Unit* /*who*/) - { - DoScriptText(SAY_DOROTHEE_AGGRO, me); - } + SummonedTito = false; + TitoDied = false; + } - void JustReachedHome() - { - me->ForcedDespawn(); - } + void EnterCombat(Unit* /*who*/) + { + DoScriptText(SAY_DOROTHEE_AGGRO, me); + } + + void JustReachedHome() + { + me->ForcedDespawn(); + } - void SummonTito(); // See below + void SummonTito(); - void JustDied(Unit* /*killer*/) - { - DoScriptText(SAY_DOROTHEE_DEATH, me); + void JustDied(Unit* /*killer*/) + { + DoScriptText(SAY_DOROTHEE_DEATH, me); - if (pInstance) - SummonCroneIfReady(pInstance, me); - } + if (pInstance) + SummonCroneIfReady(pInstance, me); + } - void AttackStart(Unit* who) - { - if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) - return; + void AttackStart(Unit* who) + { + if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + return; - ScriptedAI::AttackStart(who); - } + ScriptedAI::AttackStart(who); + } - void MoveInLineOfSight(Unit* who) - { - if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) - return; + void MoveInLineOfSight(Unit* who) + { + if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + return; - ScriptedAI::MoveInLineOfSight(who); - } + ScriptedAI::MoveInLineOfSight(who); + } - void UpdateAI(const uint32 diff) - { - if (AggroTimer) + void UpdateAI(const uint32 diff) { - if (AggroTimer <= diff) + if (AggroTimer) { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - AggroTimer = 0; - } else AggroTimer -= diff; - } + if (AggroTimer <= diff) + { + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + AggroTimer = 0; + } else AggroTimer -= diff; + } - if (!UpdateVictim()) - return; + if (!UpdateVictim()) + return; - if (WaterBoltTimer <= diff) - { - DoCast(SelectUnit(SELECT_TARGET_RANDOM, 0), SPELL_WATERBOLT); - WaterBoltTimer = TitoDied ? 1500 : 5000; - } else WaterBoltTimer -= diff; + if (WaterBoltTimer <= diff) + { + DoCast(SelectUnit(SELECT_TARGET_RANDOM, 0), SPELL_WATERBOLT); + WaterBoltTimer = TitoDied ? 1500 : 5000; + } else WaterBoltTimer -= diff; - if (FearTimer <= diff) - { - DoCast(me->getVictim(), SPELL_SCREAM); - FearTimer = 30000; - } else FearTimer -= diff; + if (FearTimer <= diff) + { + DoCast(me->getVictim(), SPELL_SCREAM); + FearTimer = 30000; + } else FearTimer -= diff; - if (!SummonedTito) - { - if (SummonTitoTimer <= diff) - SummonTito(); - else SummonTitoTimer -= diff; + if (!SummonedTito) + { + if (SummonTitoTimer <= diff) + SummonTito(); + else SummonTitoTimer -= diff; + } + + DoMeleeAttackIfReady(); } + }; - DoMeleeAttackIfReady(); - } }; - -struct mob_titoAI : public ScriptedAI +
class mob_tito : public CreatureScript { - mob_titoAI(Creature* c) : ScriptedAI(c) {} - - uint64 DorotheeGUID; - uint32 YipTimer; +public: + mob_tito() : CreatureScript("mob_tito") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - DorotheeGUID = 0; - YipTimer = 10000; + return new mob_titoAI(pCreature); } - void EnterCombat(Unit* /*who*/) {} - - void JustDied(Unit* /*killer*/) + struct mob_titoAI : public ScriptedAI { - if (DorotheeGUID) + mob_titoAI(Creature* c) : ScriptedAI(c) {} + + uint64 DorotheeGUID; + uint32 YipTimer; + + void Reset() + { + DorotheeGUID = 0; + YipTimer = 10000; + } + + void EnterCombat(Unit* /*who*/) {} + + void JustDied(Unit* /*killer*/) { - Creature* Dorothee = (Unit::GetCreature((*me), DorotheeGUID)); - if (Dorothee && Dorothee->isAlive()) + if (DorotheeGUID) { - CAST_AI(boss_dorotheeAI, Dorothee->AI())->TitoDied = true; - DoScriptText(SAY_DOROTHEE_TITO_DEATH, Dorothee); + Creature* Dorothee = (Unit::GetCreature((*me), DorotheeGUID)); + if (Dorothee && Dorothee->isAlive()) + { + CAST_AI(boss_dorothee::boss_dorotheeAI, Dorothee->AI())->TitoDied = true; + DoScriptText(SAY_DOROTHEE_TITO_DEATH, Dorothee); + } } } - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - if (YipTimer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_YIPPING); - YipTimer = 10000; - } else YipTimer -= diff; + if (!UpdateVictim()) + return; + + if (YipTimer <= diff) + { + DoCast(me->getVictim(), SPELL_YIPPING); + YipTimer = 10000; + } else YipTimer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -void boss_dorotheeAI::SummonTito() +void boss_dorothee::boss_dorotheeAI::SummonTito() { if (Creature* pTito = me->SummonCreature(CREATURE_TITO, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000)) { DoScriptText(SAY_DOROTHEE_SUMMON, me); - CAST_AI(mob_titoAI, pTito->AI())->DorotheeGUID = me->GetGUID(); + CAST_AI(mob_tito::mob_titoAI, pTito->AI())->DorotheeGUID = me->GetGUID(); pTito->AI()->AttackStart(me->getVictim()); SummonedTito = true; TitoDied = false; } } - -struct boss_strawmanAI : public ScriptedAI +
class boss_strawman : public CreatureScript { - boss_strawmanAI(Creature* c) : ScriptedAI(c) - { - pInstance = c->GetInstanceData(); - } - - ScriptedInstance* pInstance; - - uint32 AggroTimer; - uint32 BrainBashTimer; - uint32 BrainWipeTimer; +public: + boss_strawman() : CreatureScript("boss_strawman") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - AggroTimer = 13000; - BrainBashTimer = 5000; - BrainWipeTimer = 7000; + return new boss_strawmanAI(pCreature); } - void AttackStart(Unit* who) + struct boss_strawmanAI : public ScriptedAI { - if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) - return; + boss_strawmanAI(Creature* c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } - ScriptedAI::AttackStart(who); - } + InstanceScript* pInstance; - void MoveInLineOfSight(Unit* who) - { - if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) - return; + uint32 AggroTimer; + uint32 BrainBashTimer; + uint32 BrainWipeTimer; - ScriptedAI::MoveInLineOfSight(who); - } + void Reset() + { + AggroTimer = 13000; + BrainBashTimer = 5000; + BrainWipeTimer = 7000; + } - void EnterCombat(Unit* /*who*/) - { - DoScriptText(SAY_STRAWMAN_AGGRO, me); - } + void AttackStart(Unit* who) + { + if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + return; - void JustReachedHome() - { - me->ForcedDespawn(); - } + ScriptedAI::AttackStart(who); + } - void SpellHit(Unit* /*caster*/, const SpellEntry *Spell) - { - if ((Spell->SchoolMask == SPELL_SCHOOL_MASK_FIRE) && (!(rand()%10))) + void MoveInLineOfSight(Unit* who) { - /* - if (not direct damage(aoe,dot)) - return; - */ + if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + return; - DoCast(me, SPELL_BURNING_STRAW, true); + ScriptedAI::MoveInLineOfSight(who); } - } - - void JustDied(Unit* /*killer*/) - { - DoScriptText(SAY_STRAWMAN_DEATH, me); - if (pInstance) - SummonCroneIfReady(pInstance, me); - } + void EnterCombat(Unit* /*who*/) + { + DoScriptText(SAY_STRAWMAN_AGGRO, me); + } - void KilledUnit(Unit* /*victim*/) - { - DoScriptText(SAY_STRAWMAN_SLAY, me); - } + void JustReachedHome() + { + me->ForcedDespawn(); + } - void UpdateAI(const uint32 diff) - { - if (AggroTimer) + void SpellHit(Unit* /*caster*/, const SpellEntry *Spell) { - if (AggroTimer <= diff) + if ((Spell->SchoolMask == SPELL_SCHOOL_MASK_FIRE) && (!(rand()%10))) { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - AggroTimer = 0; - } else AggroTimer -= diff; + /* + if (not direct damage(aoe,dot)) + return; + */ + + DoCast(me, SPELL_BURNING_STRAW, true); + } } - if (!UpdateVictim()) - return; + void JustDied(Unit* /*killer*/) + { + DoScriptText(SAY_STRAWMAN_DEATH, me); - if (BrainBashTimer <= diff) + if (pInstance) + SummonCroneIfReady(pInstance, me); + } + + void KilledUnit(Unit* /*victim*/) { - DoCast(me->getVictim(), SPELL_BRAIN_BASH); - BrainBashTimer = 15000; - } else BrainBashTimer -= diff; + DoScriptText(SAY_STRAWMAN_SLAY, me); + } - if (BrainWipeTimer <= diff) + void UpdateAI(const uint32 diff) { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(pTarget, SPELL_BRAIN_WIPE); - BrainWipeTimer = 20000; - } else BrainWipeTimer -= diff; + if (AggroTimer) + { + if (AggroTimer <= diff) + { + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + AggroTimer = 0; + } else AggroTimer -= diff; + } - DoMeleeAttackIfReady(); - } -}; + if (!UpdateVictim()) + return; -struct boss_tinheadAI : public ScriptedAI -{ - boss_tinheadAI(Creature* c) : ScriptedAI(c) - { - pInstance = c->GetInstanceData(); - } + if (BrainBashTimer <= diff) + { + DoCast(me->getVictim(), SPELL_BRAIN_BASH); + BrainBashTimer = 15000; + } else BrainBashTimer -= diff; - ScriptedInstance* pInstance; + if (BrainWipeTimer <= diff) + { + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + DoCast(pTarget, SPELL_BRAIN_WIPE); + BrainWipeTimer = 20000; + } else BrainWipeTimer -= diff; - uint32 AggroTimer; - uint32 CleaveTimer; - uint32 RustTimer; + DoMeleeAttackIfReady(); + } + }; - uint8 RustCount; +}; +
class boss_tinhead : public CreatureScript +{ +public: + boss_tinhead() : CreatureScript("boss_tinhead") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - AggroTimer = 15000; - CleaveTimer = 5000; - RustTimer = 30000; - - RustCount = 0; + return new boss_tinheadAI(pCreature); } - void EnterCombat(Unit* /*who*/) + struct boss_tinheadAI : public ScriptedAI { - DoScriptText(SAY_TINHEAD_AGGRO, me); - } + boss_tinheadAI(Creature* c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } - void JustReachedHome() - { - me->ForcedDespawn(); - } + InstanceScript* pInstance; - void AttackStart(Unit* who) - { - if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) - return; + uint32 AggroTimer; + uint32 CleaveTimer; + uint32 RustTimer; - ScriptedAI::AttackStart(who); - } + uint8 RustCount; - void MoveInLineOfSight(Unit* who) - { - if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) - return; + void Reset() + { + AggroTimer = 15000; + CleaveTimer = 5000; + RustTimer = 30000; - ScriptedAI::MoveInLineOfSight(who); - } + RustCount = 0; + } - void JustDied(Unit* /*killer*/) - { - DoScriptText(SAY_TINHEAD_DEATH, me); + void EnterCombat(Unit* /*who*/) + { + DoScriptText(SAY_TINHEAD_AGGRO, me); + } - if (pInstance) - SummonCroneIfReady(pInstance, me); - } + void JustReachedHome() + { + me->ForcedDespawn(); + } - void KilledUnit(Unit* /*victim*/) - { - DoScriptText(SAY_TINHEAD_SLAY, me); - } + void AttackStart(Unit* who) + { + if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + return; - void UpdateAI(const uint32 diff) - { - if (AggroTimer) + ScriptedAI::AttackStart(who); + } + + void MoveInLineOfSight(Unit* who) { - if (AggroTimer <= diff) - { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - AggroTimer = 0; - } else AggroTimer -= diff; + if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + return; + + ScriptedAI::MoveInLineOfSight(who); } - if (!UpdateVictim()) - return; + void JustDied(Unit* /*killer*/) + { + DoScriptText(SAY_TINHEAD_DEATH, me); - if (CleaveTimer <= diff) + if (pInstance) + SummonCroneIfReady(pInstance, me); + } + + void KilledUnit(Unit* /*victim*/) { - DoCast(me->getVictim(), SPELL_CLEAVE); - CleaveTimer = 5000; - } else CleaveTimer -= diff; + DoScriptText(SAY_TINHEAD_SLAY, me); + } - if (RustCount < 8) + void UpdateAI(const uint32 diff) { - if (RustTimer <= diff) + if (AggroTimer) { - ++RustCount; - DoScriptText(EMOTE_RUST, me); - DoCast(me, SPELL_RUST); - RustTimer = 6000; - } else RustTimer -= diff; - } + if (AggroTimer <= diff) + { + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + AggroTimer = 0; + } else AggroTimer -= diff; + } - DoMeleeAttackIfReady(); - } -}; + if (!UpdateVictim()) + return; -struct boss_roarAI : public ScriptedAI -{ - boss_roarAI(Creature* c) : ScriptedAI(c) - { - pInstance = c->GetInstanceData(); - } + if (CleaveTimer <= diff) + { + DoCast(me->getVictim(), SPELL_CLEAVE); + CleaveTimer = 5000; + } else CleaveTimer -= diff; - ScriptedInstance* pInstance; + if (RustCount < 8) + { + if (RustTimer <= diff) + { + ++RustCount; + DoScriptText(EMOTE_RUST, me); + DoCast(me, SPELL_RUST); + RustTimer = 6000; + } else RustTimer -= diff; + } - uint32 AggroTimer; - uint32 MangleTimer; - uint32 ShredTimer; - uint32 ScreamTimer; + DoMeleeAttackIfReady(); + } + }; - void Reset() - { - AggroTimer = 20000; - MangleTimer = 5000; - ShredTimer = 10000; - ScreamTimer = 15000; - } +}; +
class boss_roar : public CreatureScript +{ +public: + boss_roar() : CreatureScript("boss_roar") { } - void MoveInLineOfSight(Unit* who) + CreatureAI* GetAI(Creature* pCreature) const { - if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) - return; - - ScriptedAI::MoveInLineOfSight(who); + return new boss_roarAI(pCreature); } - void AttackStart(Unit* who) + struct boss_roarAI : public ScriptedAI { - if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) - return; + boss_roarAI(Creature* c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } - ScriptedAI::AttackStart(who); - } + InstanceScript* pInstance; - void EnterCombat(Unit* /*who*/) - { - DoScriptText(SAY_ROAR_AGGRO, me); - } + uint32 AggroTimer; + uint32 MangleTimer; + uint32 ShredTimer; + uint32 ScreamTimer; - void JustReachedHome() - { - me->ForcedDespawn(); - } + void Reset() + { + AggroTimer = 20000; + MangleTimer = 5000; + ShredTimer = 10000; + ScreamTimer = 15000; + } - void JustDied(Unit* /*killer*/) - { - DoScriptText(SAY_ROAR_DEATH, me); + void MoveInLineOfSight(Unit* who) + { + if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + return; - if (pInstance) - SummonCroneIfReady(pInstance, me); - } + ScriptedAI::MoveInLineOfSight(who); + } - void KilledUnit(Unit* /*victim*/) - { - DoScriptText(SAY_ROAR_SLAY, me); - } + void AttackStart(Unit* who) + { + if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + return; - void UpdateAI(const uint32 diff) - { - if (AggroTimer) + ScriptedAI::AttackStart(who); + } + + void EnterCombat(Unit* /*who*/) { - if (AggroTimer <= diff) - { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - AggroTimer = 0; - } else AggroTimer -= diff; + DoScriptText(SAY_ROAR_AGGRO, me); } - if (!UpdateVictim()) - return; + void JustReachedHome() + { + me->ForcedDespawn(); + } - if (MangleTimer <= diff) + void JustDied(Unit* /*killer*/) { - DoCast(me->getVictim(), SPELL_MANGLE); - MangleTimer = urand(5000,8000); - } else MangleTimer -= diff; + DoScriptText(SAY_ROAR_DEATH, me); + + if (pInstance) + SummonCroneIfReady(pInstance, me); + } - if (ShredTimer <= diff) + void KilledUnit(Unit* /*victim*/) { - DoCast(me->getVictim(), SPELL_SHRED); - ShredTimer = urand(10000,15000); - } else ShredTimer -= diff; + DoScriptText(SAY_ROAR_SLAY, me); + } - if (ScreamTimer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_FRIGHTENED_SCREAM); - ScreamTimer = urand(20000,30000); - } else ScreamTimer -= diff; + if (AggroTimer) + { + if (AggroTimer <= diff) + { + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + AggroTimer = 0; + } else AggroTimer -= diff; + } - DoMeleeAttackIfReady(); - } -}; + if (!UpdateVictim()) + return; -struct boss_croneAI : public ScriptedAI -{ - boss_croneAI(Creature* c) : ScriptedAI(c) - { - pInstance = c->GetInstanceData(); - } + if (MangleTimer <= diff) + { + DoCast(me->getVictim(), SPELL_MANGLE); + MangleTimer = urand(5000,8000); + } else MangleTimer -= diff; - ScriptedInstance* pInstance; + if (ShredTimer <= diff) + { + DoCast(me->getVictim(), SPELL_SHRED); + ShredTimer = urand(10000,15000); + } else ShredTimer -= diff; - uint32 CycloneTimer; - uint32 ChainLightningTimer; + if (ScreamTimer <= diff) + { + DoCast(me->getVictim(), SPELL_FRIGHTENED_SCREAM); + ScreamTimer = urand(20000,30000); + } else ScreamTimer -= diff; - void Reset() - { - CycloneTimer = 30000; - ChainLightningTimer = 10000; - } + DoMeleeAttackIfReady(); + } + }; - void JustReachedHome() - { - me->ForcedDespawn(); - } +}; +
class boss_crone : public CreatureScript +{ +public: + boss_crone() : CreatureScript("boss_crone") { } - void EnterCombat(Unit* /*who*/) + CreatureAI* GetAI(Creature* pCreature) const { - DoScriptText(RAND(SAY_CRONE_AGGRO,SAY_CRONE_AGGRO2), me); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + return new boss_croneAI(pCreature); } - void JustDied(Unit* /*killer*/) + struct boss_croneAI : public ScriptedAI { - DoScriptText(SAY_CRONE_DEATH, me); - - if (pInstance) + boss_croneAI(Creature* c) : ScriptedAI(c) { - pInstance->SetData(TYPE_OPERA, DONE); - pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_STAGEDOORLEFT), true); - pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_STAGEDOORRIGHT), true); + pInstance = c->GetInstanceScript(); + } + + InstanceScript* pInstance; + + uint32 CycloneTimer; + uint32 ChainLightningTimer; - if (GameObject* pSideEntrance = pInstance->instance->GetGameObject(pInstance->GetData64(DATA_GO_SIDE_ENTRANCE_DOOR))) - pSideEntrance->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_LOCKED); + void Reset() + { + CycloneTimer = 30000; + ChainLightningTimer = 10000; } - } - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + void JustReachedHome() + { + me->ForcedDespawn(); + } - if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + void EnterCombat(Unit* /*who*/) + { + DoScriptText(RAND(SAY_CRONE_AGGRO,SAY_CRONE_AGGRO2), me); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + } - if (CycloneTimer <= diff) + void JustDied(Unit* /*killer*/) { - if (Creature* Cyclone = DoSpawnCreature(CREATURE_CYCLONE, urand(0,9), urand(0,9), 0, 0, TEMPSUMMON_TIMED_DESPAWN, 15000)) - Cyclone->CastSpell(Cyclone, SPELL_CYCLONE_VISUAL, true); - CycloneTimer = 30000; - } else CycloneTimer -= diff; + DoScriptText(SAY_CRONE_DEATH, me); + + if (pInstance) + { + pInstance->SetData(TYPE_OPERA, DONE); + pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_STAGEDOORLEFT), true); + pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_STAGEDOORRIGHT), true); + + if (GameObject* pSideEntrance = pInstance->instance->GetGameObject(pInstance->GetData64(DATA_GO_SIDE_ENTRANCE_DOOR))) + pSideEntrance->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_LOCKED); + } + } - if (ChainLightningTimer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_CHAIN_LIGHTNING); - ChainLightningTimer = 15000; - } else ChainLightningTimer -= diff; + if (!UpdateVictim()) + return; - DoMeleeAttackIfReady(); - } -}; + if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); -struct mob_cycloneAI : public ScriptedAI -{ - mob_cycloneAI(Creature* c) : ScriptedAI(c) {} + if (CycloneTimer <= diff) + { + if (Creature* Cyclone = DoSpawnCreature(CREATURE_CYCLONE, urand(0,9), urand(0,9), 0, 0, TEMPSUMMON_TIMED_DESPAWN, 15000)) + Cyclone->CastSpell(Cyclone, SPELL_CYCLONE_VISUAL, true); + CycloneTimer = 30000; + } else CycloneTimer -= diff; - uint32 MoveTimer; + if (ChainLightningTimer <= diff) + { + DoCast(me->getVictim(), SPELL_CHAIN_LIGHTNING); + ChainLightningTimer = 15000; + } else ChainLightningTimer -= diff; - void Reset() - { - MoveTimer = 1000; - } + DoMeleeAttackIfReady(); + } + }; - void EnterCombat(Unit* /*who*/) {} +}; +
class mob_cyclone : public CreatureScript +{ +public: + mob_cyclone() : CreatureScript("mob_cyclone") { } - void MoveInLineOfSight(Unit* /*who*/) + CreatureAI* GetAI(Creature* pCreature) const { + return new mob_cycloneAI(pCreature); } - void UpdateAI(const uint32 diff) + struct mob_cycloneAI : public ScriptedAI { - if (!me->HasAura(SPELL_KNOCKBACK)) - DoCast(me, SPELL_KNOCKBACK, true); + mob_cycloneAI(Creature* c) : ScriptedAI(c) {} + + uint32 MoveTimer; - if (MoveTimer <= diff) + void Reset() { - Position pos; - me->GetRandomNearPosition(pos, 10); - me->GetMotionMaster()->MovePoint(0, pos); - MoveTimer = urand(5000,8000); - } else MoveTimer -= diff; - } + MoveTimer = 1000; + } + + void EnterCombat(Unit* /*who*/) {} + + void MoveInLineOfSight(Unit* /*who*/) + { + } + + void UpdateAI(const uint32 diff) + { + if (!me->HasAura(SPELL_KNOCKBACK)) + DoCast(me, SPELL_KNOCKBACK, true); + + if (MoveTimer <= diff) + { + Position pos; + me->GetRandomNearPosition(pos, 10); + me->GetMotionMaster()->MovePoint(0, pos); + MoveTimer = urand(5000,8000); + } else MoveTimer -= diff; + } + }; + }; -CreatureAI* GetAI_boss_dorothee(Creature* pCreature) -{ - return new boss_dorotheeAI(pCreature); -} -CreatureAI* GetAI_boss_strawman(Creature* pCreature) -{ - return new boss_strawmanAI(pCreature); -} -CreatureAI* GetAI_boss_tinhead(Creature* pCreature) -{ - return new boss_tinheadAI(pCreature); -} -CreatureAI* GetAI_boss_roar(Creature* pCreature) -{ - return new boss_roarAI(pCreature); -} -CreatureAI* GetAI_boss_crone(Creature* pCreature) -{ - return new boss_croneAI(pCreature); -} -CreatureAI* GetAI_mob_tito(Creature* pCreature) -{ - return new mob_titoAI(pCreature); -} -CreatureAI* GetAI_mob_cyclone(Creature* pCreature) -{ - return new mob_cycloneAI(pCreature); -} /**************************************/ /**** Opera Red Riding Hood Event ****/ @@ -714,146 +763,160 @@ CreatureAI* GetAI_mob_cyclone(Creature* pCreature) /**** The Wolf's Entry ****/ #define CREATURE_BIG_BAD_WOLF 17521 - -bool GossipHello_npc_grandmother(Player* pPlayer, Creature* pCreature) +
class npc_grandmother : public CreatureScript { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_GRANDMA, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - pPlayer->SEND_GOSSIP_MENU(8990, pCreature->GetGUID()); +public: + npc_grandmother() : CreatureScript("npc_grandmother") { } - return true; -} + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) + { + if (uiAction == GOSSIP_ACTION_INFO_DEF) + { + if (Creature* pBigBadWolf = pCreature->SummonCreature(CREATURE_BIG_BAD_WOLF, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, HOUR*2*IN_MILLISECONDS)) + pBigBadWolf->AI()->AttackStart(pPlayer); -bool GossipSelect_npc_grandmother(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF) + pCreature->ForcedDespawn(); + } + + return true; + } + + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - if (Creature* pBigBadWolf = pCreature->SummonCreature(CREATURE_BIG_BAD_WOLF, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, HOUR*2*IN_MILLISECONDS)) - pBigBadWolf->AI()->AttackStart(pPlayer); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_GRANDMA, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); + pPlayer->SEND_GOSSIP_MENU(8990, pCreature->GetGUID()); - pCreature->ForcedDespawn(); + return true; } - return true; -} +}; -struct boss_bigbadwolfAI : public ScriptedAI +
class boss_bigbadwolf : public CreatureScript { - boss_bigbadwolfAI(Creature* c) : ScriptedAI(c) +public: + boss_bigbadwolf() : CreatureScript("boss_bigbadwolf") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_bigbadwolfAI(pCreature); } - ScriptedInstance* pInstance; + struct boss_bigbadwolfAI : public ScriptedAI + { + boss_bigbadwolfAI(Creature* c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } - uint32 ChaseTimer; - uint32 FearTimer; - uint32 SwipeTimer; + InstanceScript* pInstance; - uint64 HoodGUID; - float TempThreat; + uint32 ChaseTimer; + uint32 FearTimer; + uint32 SwipeTimer; - bool IsChasing; + uint64 HoodGUID; + float TempThreat; - void Reset() - { - ChaseTimer = 30000; - FearTimer = 25000 + rand()%10000; - SwipeTimer = 5000; + bool IsChasing; - HoodGUID = 0; - TempThreat = 0; + void Reset() + { + ChaseTimer = 30000; + FearTimer = 25000 + rand()%10000; + SwipeTimer = 5000; - IsChasing = false; - } + HoodGUID = 0; + TempThreat = 0; - void EnterCombat(Unit* /*who*/) - { - DoScriptText(SAY_WOLF_AGGRO, me); - } + IsChasing = false; + } - void JustReachedHome() - { - me->ForcedDespawn(); - } + void EnterCombat(Unit* /*who*/) + { + DoScriptText(SAY_WOLF_AGGRO, me); + } - void JustDied(Unit* /*killer*/) - { - DoPlaySoundToSet(me, SOUND_WOLF_DEATH); + void JustReachedHome() + { + me->ForcedDespawn(); + } - if (pInstance) + void JustDied(Unit* /*killer*/) { - pInstance->SetData(TYPE_OPERA, DONE); - pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_STAGEDOORLEFT), true); - pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_STAGEDOORRIGHT), true); + DoPlaySoundToSet(me, SOUND_WOLF_DEATH); - if (GameObject* pSideEntrance = pInstance->instance->GetGameObject(pInstance->GetData64(DATA_GO_SIDE_ENTRANCE_DOOR))) - pSideEntrance->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_LOCKED); + if (pInstance) + { + pInstance->SetData(TYPE_OPERA, DONE); + pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_STAGEDOORLEFT), true); + pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_STAGEDOORRIGHT), true); + + if (GameObject* pSideEntrance = pInstance->instance->GetGameObject(pInstance->GetData64(DATA_GO_SIDE_ENTRANCE_DOOR))) + pSideEntrance->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_LOCKED); + } } - } - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; - DoMeleeAttackIfReady(); + DoMeleeAttackIfReady(); - if (ChaseTimer <= diff) - { - if (!IsChasing) + if (ChaseTimer <= diff) { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + if (!IsChasing) { - DoScriptText(SAY_WOLF_HOOD, me); - DoCast(pTarget, SPELL_LITTLE_RED_RIDING_HOOD, true); - TempThreat = DoGetThreat(pTarget); - if (TempThreat) - DoModifyThreatPercent(pTarget, -100); - HoodGUID = pTarget->GetGUID(); - me->AddThreat(pTarget, 1000000.0f); - ChaseTimer = 20000; - IsChasing = true; + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + { + DoScriptText(SAY_WOLF_HOOD, me); + DoCast(pTarget, SPELL_LITTLE_RED_RIDING_HOOD, true); + TempThreat = DoGetThreat(pTarget); + if (TempThreat) + DoModifyThreatPercent(pTarget, -100); + HoodGUID = pTarget->GetGUID(); + me->AddThreat(pTarget, 1000000.0f); + ChaseTimer = 20000; + IsChasing = true; + } } - } - else - { - IsChasing = false; - - if (Unit *pTarget = Unit::GetUnit((*me), HoodGUID)) + else { - HoodGUID = 0; - if (DoGetThreat(pTarget)) - DoModifyThreatPercent(pTarget, -100); - me->AddThreat(pTarget, TempThreat); - TempThreat = 0; + IsChasing = false; + + if (Unit *pTarget = Unit::GetUnit((*me), HoodGUID)) + { + HoodGUID = 0; + if (DoGetThreat(pTarget)) + DoModifyThreatPercent(pTarget, -100); + me->AddThreat(pTarget, TempThreat); + TempThreat = 0; + } + + ChaseTimer = 40000; } + } else ChaseTimer -= diff; - ChaseTimer = 40000; - } - } else ChaseTimer -= diff; + if (IsChasing) + return; - if (IsChasing) - return; + if (FearTimer <= diff) + { + DoCast(me->getVictim(), SPELL_TERRIFYING_HOWL); + FearTimer = urand(25000,35000); + } else FearTimer -= diff; - if (FearTimer <= diff) - { - DoCast(me->getVictim(), SPELL_TERRIFYING_HOWL); - FearTimer = urand(25000,35000); - } else FearTimer -= diff; + if (SwipeTimer <= diff) + { + DoCast(me->getVictim(), SPELL_WIDE_SWIPE); + SwipeTimer = urand(25000,30000); + } else SwipeTimer -= diff; - if (SwipeTimer <= diff) - { - DoCast(me->getVictim(), SPELL_WIDE_SWIPE); - SwipeTimer = urand(25000,30000); - } else SwipeTimer -= diff; + } + }; - } }; -CreatureAI* GetAI_boss_bigbadwolf(Creature* pCreature) -{ - return new boss_bigbadwolfAI(pCreature); -} /**********************************************/ /******** Opera Romeo and Juliet Event *******/ @@ -927,327 +990,336 @@ void Resurrect(Creature *pTarget) else pTarget->GetMotionMaster()->Initialize(); }; - -struct boss_julianneAI : public ScriptedAI +
class boss_julianne : public CreatureScript { - boss_julianneAI(Creature* c) : ScriptedAI(c) +public: + boss_julianne() : CreatureScript("boss_julianne") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); - EntryYellTimer = 1000; - AggroYellTimer = 10000; - IsFakingDeath = false; + return new boss_julianneAI(pCreature); } - ScriptedInstance* pInstance; - - uint32 EntryYellTimer; - uint32 AggroYellTimer; - - uint64 RomuloGUID; - - uint32 Phase; - - uint32 BlindingPassionTimer; - uint32 DevotionTimer; - uint32 EternalAffectionTimer; - uint32 PowerfulAttractionTimer; - uint32 SummonRomuloTimer; - uint32 ResurrectTimer; - uint32 DrinkPoisonTimer; - uint32 ResurrectSelfTimer; - - bool IsFakingDeath; - bool SummonedRomulo; - bool RomuloDead; - - void Reset() + struct boss_julianneAI : public ScriptedAI { - RomuloGUID = 0; - Phase = PHASE_JULIANNE; - - BlindingPassionTimer = 30000; - DevotionTimer = 15000; - EternalAffectionTimer = 25000; - PowerfulAttractionTimer = 5000; - SummonRomuloTimer = 10000; - DrinkPoisonTimer = 0; - ResurrectSelfTimer = 0; - - if (IsFakingDeath) + boss_julianneAI(Creature* c) : ScriptedAI(c) { - Resurrect(me); + pInstance = c->GetInstanceScript(); + EntryYellTimer = 1000; + AggroYellTimer = 10000; IsFakingDeath = false; } - SummonedRomulo = false; - RomuloDead = false; - } + InstanceScript* pInstance; - void EnterCombat(Unit* /*who*/) {} + uint32 EntryYellTimer; + uint32 AggroYellTimer; - void AttackStart(Unit* who) - { - if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) - return; - - ScriptedAI::AttackStart(who); - } + uint64 RomuloGUID; - void MoveInLineOfSight(Unit* who) - { - if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) - return; + uint32 Phase; - ScriptedAI::MoveInLineOfSight(who); - } + uint32 BlindingPassionTimer; + uint32 DevotionTimer; + uint32 EternalAffectionTimer; + uint32 PowerfulAttractionTimer; + uint32 SummonRomuloTimer; + uint32 ResurrectTimer; + uint32 DrinkPoisonTimer; + uint32 ResurrectSelfTimer; - void JustReachedHome() - { - me->ForcedDespawn(); - } + bool IsFakingDeath; + bool SummonedRomulo; + bool RomuloDead; - void SpellHit(Unit* /*caster*/, const SpellEntry *Spell) - { - if (Spell->Id == SPELL_DRINK_POISON) + void Reset() { - DoScriptText(SAY_JULIANNE_DEATH01, me); - DrinkPoisonTimer = 2500; - } - } + RomuloGUID = 0; + Phase = PHASE_JULIANNE; - void DamageTaken(Unit* done_by, uint32 &damage); + BlindingPassionTimer = 30000; + DevotionTimer = 15000; + EternalAffectionTimer = 25000; + PowerfulAttractionTimer = 5000; + SummonRomuloTimer = 10000; + DrinkPoisonTimer = 0; + ResurrectSelfTimer = 0; - void JustDied(Unit* /*killer*/) - { - DoScriptText(SAY_JULIANNE_DEATH02, me); + if (IsFakingDeath) + { + Resurrect(me); + IsFakingDeath = false; + } - if (pInstance) - { - pInstance->SetData(TYPE_OPERA, DONE); - pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_STAGEDOORLEFT), true); - pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_STAGEDOORRIGHT), true); - if (GameObject* pSideEntrance = pInstance->instance->GetGameObject(pInstance->GetData64(DATA_GO_SIDE_ENTRANCE_DOOR))) - pSideEntrance->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_LOCKED); + SummonedRomulo = false; + RomuloDead = false; } - } - - void KilledUnit(Unit* /*victim*/) - { - DoScriptText(SAY_JULIANNE_SLAY, me); - } - - void UpdateAI(const uint32 diff); -}; - -struct boss_romuloAI : public ScriptedAI -{ - boss_romuloAI(Creature* c) : ScriptedAI(c) - { - pInstance = c->GetInstanceData(); - EntryYellTimer = 8000; - AggroYellTimer = 15000; - } - - ScriptedInstance* pInstance; - - uint64 JulianneGUID; - uint32 Phase; - - uint32 EntryYellTimer; - uint32 AggroYellTimer; - uint32 BackwardLungeTimer; - uint32 DaringTimer; - uint32 DeadlySwatheTimer; - uint32 PoisonThrustTimer; - uint32 ResurrectTimer; - bool IsFakingDeath; - bool JulianneDead; + void EnterCombat(Unit* /*who*/) {} - void Reset() - { - JulianneGUID = 0; - Phase = PHASE_ROMULO; + void AttackStart(Unit* who) + { + if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + return; - BackwardLungeTimer = 15000; - DaringTimer = 20000; - DeadlySwatheTimer = 25000; - PoisonThrustTimer = 10000; - ResurrectTimer = 10000; + ScriptedAI::AttackStart(who); + } - IsFakingDeath = false; - JulianneDead = false; - } + void MoveInLineOfSight(Unit* who) + { + if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + return; - void JustReachedHome() - { - me->ForcedDespawn(); - } + ScriptedAI::MoveInLineOfSight(who); + } - void DamageTaken(Unit* done_by, uint32 &damage); + void JustReachedHome() + { + me->ForcedDespawn(); + } - void EnterCombat(Unit* /*who*/) - { - DoScriptText(SAY_ROMULO_AGGRO, me); - if (JulianneGUID) + void SpellHit(Unit* /*caster*/, const SpellEntry *Spell) { - Creature* Julianne = (Unit::GetCreature((*me), JulianneGUID)); - if (Julianne && Julianne->getVictim()) + if (Spell->Id == SPELL_DRINK_POISON) { - me->AddThreat(Julianne->getVictim(), 1.0f); - AttackStart(Julianne->getVictim()); + DoScriptText(SAY_JULIANNE_DEATH01, me); + DrinkPoisonTimer = 2500; } } - } - void MoveInLineOfSight(Unit* who) - { - if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) - return; + void DamageTaken(Unit* /*done_by*/, uint32 &damage); - ScriptedAI::MoveInLineOfSight(who); - } + void JustDied(Unit* /*killer*/) + { + DoScriptText(SAY_JULIANNE_DEATH02, me); - void JustDied(Unit* /*killer*/) - { - DoScriptText(SAY_ROMULO_DEATH, me); + if (pInstance) + { + pInstance->SetData(TYPE_OPERA, DONE); + pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_STAGEDOORLEFT), true); + pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_STAGEDOORRIGHT), true); + if (GameObject* pSideEntrance = pInstance->instance->GetGameObject(pInstance->GetData64(DATA_GO_SIDE_ENTRANCE_DOOR))) + pSideEntrance->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_LOCKED); + } + } - if (pInstance) + void KilledUnit(Unit* /*victim*/) { - pInstance->SetData(TYPE_OPERA, DONE); - pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_STAGEDOORLEFT), true); - pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_STAGEDOORRIGHT), true); - - if (GameObject* pSideEntrance = pInstance->instance->GetGameObject(pInstance->GetData64(DATA_GO_SIDE_ENTRANCE_DOOR))) - pSideEntrance->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_LOCKED); + DoScriptText(SAY_JULIANNE_SLAY, me); } - } - void KilledUnit(Unit* /*victim*/) - { - DoScriptText(SAY_ROMULO_SLAY, me); - } + void UpdateAI(const uint32 diff); + }; - void UpdateAI(const uint32 diff); }; - -void boss_julianneAI::DamageTaken(Unit* /*done_by*/, uint32 &damage) +
class boss_romulo : public CreatureScript { - if (damage < me->GetHealth()) - return; +public: + boss_romulo() : CreatureScript("boss_romulo") { } - //anything below only used if incoming damage will kill + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_romuloAI(pCreature); + } - if (Phase == PHASE_JULIANNE) + struct boss_romuloAI : public ScriptedAI { - damage = 0; + boss_romuloAI(Creature* c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + EntryYellTimer = 8000; + AggroYellTimer = 15000; + } - //this means already drinking, so return - if (IsFakingDeath) - return; + InstanceScript* pInstance; - me->InterruptNonMeleeSpells(true); - DoCast(me, SPELL_DRINK_POISON); + uint64 JulianneGUID; + uint32 Phase; - IsFakingDeath = true; - //IS THIS USEFULL? Creature* Julianne = (Unit::GetCreature((*me), JulianneGUID)); - return; - } + uint32 EntryYellTimer; + uint32 AggroYellTimer; + uint32 BackwardLungeTimer; + uint32 DaringTimer; + uint32 DeadlySwatheTimer; + uint32 PoisonThrustTimer; + uint32 ResurrectTimer; - if (Phase == PHASE_ROMULO) - { - sLog.outError("TSCR: boss_julianneAI: cannot take damage in PHASE_ROMULO, why was i here?"); - damage = 0; - return; - } + bool IsFakingDeath; + bool JulianneDead; - if (Phase == PHASE_BOTH) - { - //if this is true then we have to kill romulo too - if (RomuloDead) + void Reset() { - if (Creature* Romulo = (Unit::GetCreature((*me), RomuloGUID))) - { - Romulo->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - Romulo->GetMotionMaster()->Clear(); - Romulo->setDeathState(JUST_DIED); - Romulo->CombatStop(true); - Romulo->DeleteThreatList(); - Romulo->SetUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); - } + JulianneGUID = 0; + Phase = PHASE_ROMULO; - return; + BackwardLungeTimer = 15000; + DaringTimer = 20000; + DeadlySwatheTimer = 25000; + PoisonThrustTimer = 10000; + ResurrectTimer = 10000; + + IsFakingDeath = false; + JulianneDead = false; } - //if not already returned, then romulo is alive and we can pretend die - if (Creature* Romulo = (Unit::GetCreature((*me), RomuloGUID))) + void JustReachedHome() { - PretendToDie(me); - IsFakingDeath = true; - CAST_AI(boss_romuloAI, Romulo->AI())->ResurrectTimer = 10000; - CAST_AI(boss_romuloAI, Romulo->AI())->JulianneDead = true; - damage = 0; - return; + me->ForcedDespawn(); } - } - sLog.outError("TSCR: boss_julianneAI: DamageTaken reach end of code, that should not happen."); -} - -void boss_romuloAI::DamageTaken(Unit* /*done_by*/, uint32 &damage) -{ - if (damage < me->GetHealth()) - return; - - //anything below only used if incoming damage will kill - if (Phase == PHASE_ROMULO) - { - DoScriptText(SAY_ROMULO_DEATH, me); - PretendToDie(me); - IsFakingDeath = true; - Phase = PHASE_BOTH; + void DamageTaken(Unit* /*done_by*/, uint32 &damage) + { + if (damage < me->GetHealth()) + return; + + //anything below only used if incoming damage will kill + + if (Phase == PHASE_ROMULO) + { + DoScriptText(SAY_ROMULO_DEATH, me); + PretendToDie(me); + IsFakingDeath = true; + Phase = PHASE_BOTH; + + if (Creature* Julianne = (Unit::GetCreature((*me), JulianneGUID))) + { + CAST_AI(boss_julianne::boss_julianneAI, Julianne->AI())->RomuloDead = true; + CAST_AI(boss_julianne::boss_julianneAI, Julianne->AI())->ResurrectSelfTimer = 10000; + } + + damage = 0; + return; + } + + if (Phase == PHASE_BOTH) + { + if (JulianneDead) + { + if (Creature* Julianne = (Unit::GetCreature((*me), JulianneGUID))) + { + Julianne->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + Julianne->GetMotionMaster()->Clear(); + Julianne->setDeathState(JUST_DIED); + Julianne->CombatStop(true); + Julianne->DeleteThreatList(); + Julianne->SetUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); + } + return; + } + + if (Creature* Julianne = (Unit::GetCreature((*me), JulianneGUID))) + { + PretendToDie(me); + IsFakingDeath = true; + CAST_AI(boss_julianne::boss_julianneAI, Julianne->AI())->ResurrectTimer = 10000; + CAST_AI(boss_julianne::boss_julianneAI, Julianne->AI())->RomuloDead = true; + damage = 0; + return; + } + } + + sLog.outError("TSCR: boss_romuloAI: DamageTaken reach end of code, that should not happen."); + } - if (Creature* Julianne = (Unit::GetCreature((*me), JulianneGUID))) + void EnterCombat(Unit* /*who*/) { - CAST_AI(boss_julianneAI, Julianne->AI())->RomuloDead = true; - CAST_AI(boss_julianneAI, Julianne->AI())->ResurrectSelfTimer = 10000; + DoScriptText(SAY_ROMULO_AGGRO, me); + if (JulianneGUID) + { + Creature* Julianne = (Unit::GetCreature((*me), JulianneGUID)); + if (Julianne && Julianne->getVictim()) + { + me->AddThreat(Julianne->getVictim(), 1.0f); + AttackStart(Julianne->getVictim()); + } + } } - damage = 0; - return; - } + void MoveInLineOfSight(Unit* who) + { + if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + return; - if (Phase == PHASE_BOTH) - { - if (JulianneDead) + ScriptedAI::MoveInLineOfSight(who); + } + + void JustDied(Unit* /*killer*/) { - if (Creature* Julianne = (Unit::GetCreature((*me), JulianneGUID))) + DoScriptText(SAY_ROMULO_DEATH, me); + + if (pInstance) { - Julianne->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - Julianne->GetMotionMaster()->Clear(); - Julianne->setDeathState(JUST_DIED); - Julianne->CombatStop(true); - Julianne->DeleteThreatList(); - Julianne->SetUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); + pInstance->SetData(TYPE_OPERA, DONE); + pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_STAGEDOORLEFT), true); + pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_STAGEDOORRIGHT), true); + + if (GameObject* pSideEntrance = pInstance->instance->GetGameObject(pInstance->GetData64(DATA_GO_SIDE_ENTRANCE_DOOR))) + pSideEntrance->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_LOCKED); } - return; } - if (Creature* Julianne = (Unit::GetCreature((*me), JulianneGUID))) + void KilledUnit(Unit* /*victim*/) { - PretendToDie(me); - IsFakingDeath = true; - CAST_AI(boss_julianneAI, Julianne->AI())->ResurrectTimer = 10000; - CAST_AI(boss_julianneAI, Julianne->AI())->RomuloDead = true; - damage = 0; - return; + DoScriptText(SAY_ROMULO_SLAY, me); } - } - sLog.outError("TSCR: boss_romuloAI: DamageTaken reach end of code, that should not happen."); -} + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim() || IsFakingDeath) + return; + + if (JulianneDead) + { + if (ResurrectTimer <= diff) + { + Creature* Julianne = (Unit::GetCreature((*me), JulianneGUID)); + if (Julianne && CAST_AI(boss_julianne::boss_julianneAI, Julianne->AI())->IsFakingDeath) + { + DoScriptText(SAY_ROMULO_RESURRECT, me); + Resurrect(Julianne); + CAST_AI(boss_julianne::boss_julianneAI, Julianne->AI())->IsFakingDeath = false; + JulianneDead = false; + ResurrectTimer = 10000; + } + } else ResurrectTimer -= diff; + } + + if (BackwardLungeTimer <= diff) + { + Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true); + if (pTarget && !me->HasInArc(M_PI, pTarget)) + { + DoCast(pTarget, SPELL_BACKWARD_LUNGE); + BackwardLungeTimer = urand(15000,30000); + } + } else BackwardLungeTimer -= diff; + + if (DaringTimer <= diff) + { + DoCast(me, SPELL_DARING); + DaringTimer = urand(20000,40000); + } else DaringTimer -= diff; + + if (DeadlySwatheTimer <= diff) + { + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + DoCast(pTarget, SPELL_DEADLY_SWATHE); + DeadlySwatheTimer = urand(15000,25000); + } else DeadlySwatheTimer -= diff; + + if (PoisonThrustTimer <= diff) + { + DoCast(me->getVictim(), SPELL_POISON_THRUST); + PoisonThrustTimer = urand(10000,20000); + } else PoisonThrustTimer -= diff; + + DoMeleeAttackIfReady(); + } + }; -void boss_julianneAI::UpdateAI(const uint32 diff) +}; + +void boss_julianne::boss_julianneAI::UpdateAI(const uint32 diff) { if (EntryYellTimer) { @@ -1288,8 +1360,8 @@ void boss_julianneAI::UpdateAI(const uint32 diff) if (Creature* pRomulo = me->SummonCreature(CREATURE_ROMULO, ROMULO_X, ROMULO_Y, me->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, HOUR*2*IN_MILLISECONDS)) { RomuloGUID = pRomulo->GetGUID(); - CAST_AI(boss_romuloAI, pRomulo->AI())->JulianneGUID = me->GetGUID(); - CAST_AI(boss_romuloAI, pRomulo->AI())->Phase = PHASE_ROMULO; + CAST_AI(boss_romulo::boss_romuloAI, pRomulo->AI())->JulianneGUID = me->GetGUID(); + CAST_AI(boss_romulo::boss_romuloAI, pRomulo->AI())->Phase = PHASE_ROMULO; DoZoneInCombat(pRomulo); pRomulo->setFaction(16); @@ -1322,11 +1394,11 @@ void boss_julianneAI::UpdateAI(const uint32 diff) if (ResurrectTimer <= diff) { Creature* Romulo = (Unit::GetCreature((*me), RomuloGUID)); - if (Romulo && CAST_AI(boss_romuloAI, Romulo->AI())->IsFakingDeath) + if (Romulo && CAST_AI(boss_romulo::boss_romuloAI, Romulo->AI())->IsFakingDeath) { DoScriptText(SAY_JULIANNE_RESURRECT, me); Resurrect(Romulo); - CAST_AI(boss_romuloAI, Romulo->AI())->IsFakingDeath = false; + CAST_AI(boss_romulo::boss_romuloAI, Romulo->AI())->IsFakingDeath = false; RomuloDead = false; ResurrectTimer = 10000; } @@ -1367,130 +1439,80 @@ void boss_julianneAI::UpdateAI(const uint32 diff) DoMeleeAttackIfReady(); } -void boss_romuloAI::UpdateAI(const uint32 diff) +void boss_julianne::boss_julianneAI::DamageTaken(Unit* /*done_by*/, uint32 &damage) { - if (!UpdateVictim() || IsFakingDeath) + if (damage < me->GetHealth()) return; - if (JulianneDead) - { - if (ResurrectTimer <= diff) - { - Creature* Julianne = (Unit::GetCreature((*me), JulianneGUID)); - if (Julianne && CAST_AI(boss_julianneAI, Julianne->AI())->IsFakingDeath) - { - DoScriptText(SAY_ROMULO_RESURRECT, me); - Resurrect(Julianne); - CAST_AI(boss_julianneAI, Julianne->AI())->IsFakingDeath = false; - JulianneDead = false; - ResurrectTimer = 10000; - } - } else ResurrectTimer -= diff; - } + //anything below only used if incoming damage will kill - if (BackwardLungeTimer <= diff) + if (Phase == PHASE_JULIANNE) { - Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true); - if (pTarget && !me->HasInArc(M_PI, pTarget)) - { - DoCast(pTarget, SPELL_BACKWARD_LUNGE); - BackwardLungeTimer = urand(15000,30000); - } - } else BackwardLungeTimer -= diff; + damage = 0; - if (DaringTimer <= diff) - { - DoCast(me, SPELL_DARING); - DaringTimer = urand(20000,40000); - } else DaringTimer -= diff; + //this means already drinking, so return + if (IsFakingDeath) + return; + + me->InterruptNonMeleeSpells(true); + DoCast(me, SPELL_DRINK_POISON); - if (DeadlySwatheTimer <= diff) + IsFakingDeath = true; + //IS THIS USEFULL? Creature* Julianne = (Unit::GetCreature((*me), JulianneGUID)); + return; + } + + if (Phase == PHASE_ROMULO) { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(pTarget, SPELL_DEADLY_SWATHE); - DeadlySwatheTimer = urand(15000,25000); - } else DeadlySwatheTimer -= diff; + sLog.outError("TSCR: boss_julianneAI: cannot take damage in PHASE_ROMULO, why was i here?"); + damage = 0; + return; + } - if (PoisonThrustTimer <= diff) + if (Phase == PHASE_BOTH) { - DoCast(me->getVictim(), SPELL_POISON_THRUST); - PoisonThrustTimer = urand(10000,20000); - } else PoisonThrustTimer -= diff; + //if this is true then we have to kill romulo too + if (RomuloDead) + { + if (Creature* Romulo = (Unit::GetCreature((*me), RomuloGUID))) + { + Romulo->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + Romulo->GetMotionMaster()->Clear(); + Romulo->setDeathState(JUST_DIED); + Romulo->CombatStop(true); + Romulo->DeleteThreatList(); + Romulo->SetUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); + } - DoMeleeAttackIfReady(); -} + return; + } -CreatureAI* GetAI_boss_julianne(Creature* pCreature) -{ - return new boss_julianneAI(pCreature); + //if not already returned, then romulo is alive and we can pretend die + if (Creature* Romulo = (Unit::GetCreature((*me), RomuloGUID))) + { + PretendToDie(me); + IsFakingDeath = true; + CAST_AI(boss_romulo::boss_romuloAI, Romulo->AI())->ResurrectTimer = 10000; + CAST_AI(boss_romulo::boss_romuloAI, Romulo->AI())->JulianneDead = true; + damage = 0; + return; + } + } + sLog.outError("TSCR: boss_julianneAI: DamageTaken reach end of code, that should not happen."); } -CreatureAI* GetAI_boss_romulo(Creature* pCreature) -{ - return new boss_romuloAI(pCreature); -} void AddSC_bosses_opera() { - Script* newscript; - - // Oz - newscript = new Script; - newscript->GetAI = &GetAI_boss_dorothee; - newscript->Name = "boss_dorothee"; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->GetAI = &GetAI_boss_strawman; - newscript->Name = "boss_strawman"; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->GetAI = &GetAI_boss_tinhead; - newscript->Name = "boss_tinhead"; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->GetAI = &GetAI_boss_roar; - newscript->Name = "boss_roar"; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->GetAI = &GetAI_boss_crone; - newscript->Name = "boss_crone"; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->GetAI = &GetAI_mob_tito; - newscript->Name = "mob_tito"; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->GetAI = &GetAI_mob_cyclone; - newscript->Name = "mob_cyclone"; - newscript->RegisterSelf(); - - // Hood - newscript = new Script; - newscript->pGossipHello = &GossipHello_npc_grandmother; - newscript->pGossipSelect = &GossipSelect_npc_grandmother; - newscript->Name = "npc_grandmother"; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->GetAI = &GetAI_boss_bigbadwolf; - newscript->Name = "boss_bigbadwolf"; - newscript->RegisterSelf(); - - // Romeo And Juliet - newscript = new Script; - newscript->GetAI = &GetAI_boss_julianne; - newscript->Name = "boss_julianne"; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->GetAI = &GetAI_boss_romulo; - newscript->Name = "boss_romulo"; - newscript->RegisterSelf(); + new boss_dorothee(); + new boss_strawman(); + new boss_tinhead(); + new boss_roar(); + new boss_crone(); + new mob_tito(); + new mob_cyclone(); + new npc_grandmother(); + new boss_bigbadwolf(); + new boss_julianne(); + new boss_romulo(); } - diff --git a/src/server/scripts/EasternKingdoms/Karazhan/instance_karazhan.cpp b/src/server/scripts/EasternKingdoms/Karazhan/instance_karazhan.cpp index 7a7039b94fe..5928cc434c8 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/instance_karazhan.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/instance_karazhan.cpp @@ -42,269 +42,271 @@ EndScriptData */ 10 - Prince Malchezzar 11 - Nightbane */ - -struct instance_karazhan : public ScriptedInstance +
class instance_karazhan : public InstanceMapScript { - instance_karazhan(Map* pMap) : ScriptedInstance(pMap) {Initialize();} - - uint32 m_auiEncounter[MAX_ENCOUNTER]; - std::string strSaveData; - - uint32 m_uiOperaEvent; - uint32 m_uiOzDeathCount; - - uint64 m_uiCurtainGUID; - uint64 m_uiStageDoorLeftGUID; - uint64 m_uiStageDoorRightGUID; - uint64 m_uiKilrekGUID; - uint64 m_uiTerestianGUID; - uint64 m_uiMoroesGUID; - uint64 m_uiLibraryDoor; // Door at Shade of Aran - uint64 m_uiMassiveDoor; // Door at Netherspite - uint64 m_uiSideEntranceDoor; // Side Entrance - uint64 m_uiGamesmansDoor; // Door before Chess - uint64 m_uiGamesmansExitDoor; // Door after Chess - uint64 m_uiNetherspaceDoor; // Door at Malchezaar - uint64 MastersTerraceDoor[2]; - uint64 ImageGUID; - uint64 DustCoveredChest; - - void Initialize() - { - memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - - // 1 - OZ, 2 - HOOD, 3 - RAJ, this never gets altered. - m_uiOperaEvent = urand(1,3); - m_uiOzDeathCount = 0; - - m_uiCurtainGUID = 0; - m_uiStageDoorLeftGUID = 0; - m_uiStageDoorRightGUID = 0; - - m_uiKilrekGUID = 0; - m_uiTerestianGUID = 0; - m_uiMoroesGUID = 0; - - m_uiLibraryDoor = 0; - m_uiMassiveDoor = 0; - m_uiSideEntranceDoor = 0; - m_uiGamesmansDoor = 0; - m_uiGamesmansExitDoor = 0; - m_uiNetherspaceDoor = 0; - MastersTerraceDoor[0]= 0; - MastersTerraceDoor[1]= 0; - ImageGUID = 0; - DustCoveredChest = 0; - } +public: + instance_karazhan() : InstanceMapScript("instance_karazhan") { } - bool IsEncounterInProgress() const + InstanceScript* GetInstanceData_InstanceMapScript(Map* pMap) { - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) - return true; - - return false; + return new instance_karazhan_InstanceMapScript(pMap); } - void OnCreatureCreate(Creature* pCreature, bool /*add*/) + struct instance_karazhan_InstanceMapScript : public InstanceScript { - switch (pCreature->GetEntry()) + instance_karazhan_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {Initialize();} + + uint32 m_auiEncounter[MAX_ENCOUNTER]; + std::string strSaveData; + + uint32 m_uiOperaEvent; + uint32 m_uiOzDeathCount; + + uint64 m_uiCurtainGUID; + uint64 m_uiStageDoorLeftGUID; + uint64 m_uiStageDoorRightGUID; + uint64 m_uiKilrekGUID; + uint64 m_uiTerestianGUID; + uint64 m_uiMoroesGUID; + uint64 m_uiLibraryDoor; // Door at Shade of Aran + uint64 m_uiMassiveDoor; // Door at Netherspite + uint64 m_uiSideEntranceDoor; // Side Entrance + uint64 m_uiGamesmansDoor; // Door before Chess + uint64 m_uiGamesmansExitDoor; // Door after Chess + uint64 m_uiNetherspaceDoor; // Door at Malchezaar + uint64 MastersTerraceDoor[2]; + uint64 ImageGUID; + uint64 DustCoveredChest; + + void Initialize() { - case 17229: m_uiKilrekGUID = pCreature->GetGUID(); break; - case 15688: m_uiTerestianGUID = pCreature->GetGUID(); break; - case 15687: m_uiMoroesGUID = pCreature->GetGUID(); break; + memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); + + // 1 - OZ, 2 - HOOD, 3 - RAJ, this never gets altered. + m_uiOperaEvent = urand(1,3); + m_uiOzDeathCount = 0; + + m_uiCurtainGUID = 0; + m_uiStageDoorLeftGUID = 0; + m_uiStageDoorRightGUID = 0; + + m_uiKilrekGUID = 0; + m_uiTerestianGUID = 0; + m_uiMoroesGUID = 0; + + m_uiLibraryDoor = 0; + m_uiMassiveDoor = 0; + m_uiSideEntranceDoor = 0; + m_uiGamesmansDoor = 0; + m_uiGamesmansExitDoor = 0; + m_uiNetherspaceDoor = 0; + MastersTerraceDoor[0]= 0; + MastersTerraceDoor[1]= 0; + ImageGUID = 0; + DustCoveredChest = 0; } - } - void SetData(uint32 type, uint32 uiData) - { - switch (type) + bool IsEncounterInProgress() const { - case TYPE_ATTUMEN: m_auiEncounter[0] = uiData; break; - case TYPE_MOROES: - if (m_auiEncounter[1] == DONE) - break; - m_auiEncounter[1] = uiData; - break; - case TYPE_MAIDEN: m_auiEncounter[2] = uiData; break; - case TYPE_OPTIONAL_BOSS: m_auiEncounter[3] = uiData; break; - case TYPE_OPERA: m_auiEncounter[4] = uiData; break; - case TYPE_CURATOR: m_auiEncounter[5] = uiData; break; - case TYPE_ARAN: m_auiEncounter[6] = uiData; break; - case TYPE_TERESTIAN: m_auiEncounter[7] = uiData; break; - case TYPE_NETHERSPITE: m_auiEncounter[8] = uiData; break; - case TYPE_CHESS: - if (uiData == DONE) - DoRespawnGameObject(DustCoveredChest,DAY); - m_auiEncounter[9] = uiData; - break; - case TYPE_MALCHEZZAR: m_auiEncounter[10] = uiData; break; - case TYPE_NIGHTBANE: - if (m_auiEncounter[11] != DONE) - m_auiEncounter[11] = uiData; - break; - case DATA_OPERA_OZ_DEATHCOUNT: - if (uiData == SPECIAL) - ++m_uiOzDeathCount; - else if (uiData == IN_PROGRESS) - m_uiOzDeathCount = 0; - 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()) + { + case 17229: m_uiKilrekGUID = pCreature->GetGUID(); break; + case 15688: m_uiTerestianGUID = pCreature->GetGUID(); break; + case 15687: m_uiMoroesGUID = pCreature->GetGUID(); break; + } } - if (uiData == DONE) + void SetData(uint32 type, uint32 uiData) { - OUT_SAVE_INST_DATA; + switch (type) + { + case TYPE_ATTUMEN: m_auiEncounter[0] = uiData; break; + case TYPE_MOROES: + if (m_auiEncounter[1] == DONE) + break; + m_auiEncounter[1] = uiData; + break; + case TYPE_MAIDEN: m_auiEncounter[2] = uiData; break; + case TYPE_OPTIONAL_BOSS: m_auiEncounter[3] = uiData; break; + case TYPE_OPERA: m_auiEncounter[4] = uiData; break; + case TYPE_CURATOR: m_auiEncounter[5] = uiData; break; + case TYPE_ARAN: m_auiEncounter[6] = uiData; break; + case TYPE_TERESTIAN: m_auiEncounter[7] = uiData; break; + case TYPE_NETHERSPITE: m_auiEncounter[8] = uiData; break; + case TYPE_CHESS: + if (uiData == DONE) + DoRespawnGameObject(DustCoveredChest,DAY); + m_auiEncounter[9] = uiData; + break; + case TYPE_MALCHEZZAR: m_auiEncounter[10] = uiData; break; + case TYPE_NIGHTBANE: + if (m_auiEncounter[11] != DONE) + m_auiEncounter[11] = uiData; + break; + case DATA_OPERA_OZ_DEATHCOUNT: + if (uiData == SPECIAL) + ++m_uiOzDeathCount; + else if (uiData == IN_PROGRESS) + m_uiOzDeathCount = 0; + break; + } + + if (uiData == DONE) + { + 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] << " " << m_auiEncounter[9] << " " << m_auiEncounter[10] << " " << m_auiEncounter[11]; + 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] << " " << m_auiEncounter[9] << " " << m_auiEncounter[10] << " " << m_auiEncounter[11]; - strSaveData = saveStream.str(); + strSaveData = saveStream.str(); - SaveToDB(); - OUT_SAVE_INST_DATA_COMPLETE; + SaveToDB(); + OUT_SAVE_INST_DATA_COMPLETE; + } } - } - void SetData64(uint32 identifier, uint64 data) - { - switch(identifier) + void SetData64(uint32 identifier, uint64 data) { - case DATA_IMAGE_OF_MEDIVH: ImageGUID = data; + switch(identifier) + { + case DATA_IMAGE_OF_MEDIVH: ImageGUID = data; + } } - } - void OnGameObjectCreate(GameObject* pGo, bool /*add*/) - { - switch(pGo->GetEntry()) + void OnGameObjectCreate(GameObject* pGo, bool /*add*/) { - case 183932: m_uiCurtainGUID = pGo->GetGUID(); break; - case 184278: - m_uiStageDoorLeftGUID = pGo->GetGUID(); - if (m_auiEncounter[4] == DONE) - pGo->SetGoState(GO_STATE_ACTIVE); - break; - case 184279: - m_uiStageDoorRightGUID = pGo->GetGUID(); - if (m_auiEncounter[4] == DONE) - pGo->SetGoState(GO_STATE_ACTIVE); - break; - case 184517: m_uiLibraryDoor = pGo->GetGUID(); break; - case 185521: m_uiMassiveDoor = pGo->GetGUID(); break; - case 184276: m_uiGamesmansDoor = pGo->GetGUID(); break; - case 184277: m_uiGamesmansExitDoor = pGo->GetGUID(); break; - case 185134: m_uiNetherspaceDoor = pGo->GetGUID(); break; - case 184274: MastersTerraceDoor[0] = pGo->GetGUID(); break; - case 184280: MastersTerraceDoor[1] = pGo->GetGUID(); break; - case 184275: - m_uiSideEntranceDoor = pGo->GetGUID(); - if (m_auiEncounter[4] == DONE) - pGo->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_LOCKED); - else - pGo->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_LOCKED); - break; - case 185119: DustCoveredChest = pGo->GetGUID(); break; - } + switch(pGo->GetEntry()) + { + case 183932: m_uiCurtainGUID = pGo->GetGUID(); break; + case 184278: + m_uiStageDoorLeftGUID = pGo->GetGUID(); + if (m_auiEncounter[4] == DONE) + pGo->SetGoState(GO_STATE_ACTIVE); + break; + case 184279: + m_uiStageDoorRightGUID = pGo->GetGUID(); + if (m_auiEncounter[4] == DONE) + pGo->SetGoState(GO_STATE_ACTIVE); + break; + case 184517: m_uiLibraryDoor = pGo->GetGUID(); break; + case 185521: m_uiMassiveDoor = pGo->GetGUID(); break; + case 184276: m_uiGamesmansDoor = pGo->GetGUID(); break; + case 184277: m_uiGamesmansExitDoor = pGo->GetGUID(); break; + case 185134: m_uiNetherspaceDoor = pGo->GetGUID(); break; + case 184274: MastersTerraceDoor[0] = pGo->GetGUID(); break; + case 184280: MastersTerraceDoor[1] = pGo->GetGUID(); break; + case 184275: + m_uiSideEntranceDoor = pGo->GetGUID(); + if (m_auiEncounter[4] == DONE) + pGo->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_LOCKED); + else + pGo->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_LOCKED); + break; + case 185119: DustCoveredChest = pGo->GetGUID(); break; + } - switch(m_uiOperaEvent) - { - //TODO: Set Object visibilities for Opera based on performance - case EVENT_OZ: - break; + switch(m_uiOperaEvent) + { + //TODO: Set Object visibilities for Opera based on performance + case EVENT_OZ: + break; - case EVENT_HOOD: - break; + case EVENT_HOOD: + break; - case EVENT_RAJ: - break; + case EVENT_RAJ: + break; + } } - } - std::string GetSaveData() - { - return strSaveData; - } - - uint32 GetData(uint32 uiData) - { - switch (uiData) + std::string GetSaveData() { - case TYPE_ATTUMEN: return m_auiEncounter[0]; - case TYPE_MOROES: return m_auiEncounter[1]; - case TYPE_MAIDEN: return m_auiEncounter[2]; - case TYPE_OPTIONAL_BOSS: return m_auiEncounter[3]; - case TYPE_OPERA: return m_auiEncounter[4]; - case TYPE_CURATOR: return m_auiEncounter[5]; - case TYPE_ARAN: return m_auiEncounter[6]; - case TYPE_TERESTIAN: return m_auiEncounter[7]; - case TYPE_NETHERSPITE: return m_auiEncounter[8]; - case TYPE_CHESS: return m_auiEncounter[9]; - case TYPE_MALCHEZZAR: return m_auiEncounter[10]; - case TYPE_NIGHTBANE: return m_auiEncounter[11]; - case DATA_OPERA_PERFORMANCE: return m_uiOperaEvent; - case DATA_OPERA_OZ_DEATHCOUNT: return m_uiOzDeathCount; - case DATA_IMAGE_OF_MEDIVH: return ImageGUID; + return strSaveData; } - return 0; - } - - uint64 GetData64(uint32 uiData) - { - switch (uiData) + uint32 GetData(uint32 uiData) { - case DATA_KILREK: return m_uiKilrekGUID; - case DATA_TERESTIAN: return m_uiTerestianGUID; - case DATA_MOROES: return m_uiMoroesGUID; - case DATA_GO_STAGEDOORLEFT: return m_uiStageDoorLeftGUID; - case DATA_GO_STAGEDOORRIGHT: return m_uiStageDoorRightGUID; - case DATA_GO_CURTAINS: return m_uiCurtainGUID; - case DATA_GO_LIBRARY_DOOR: return m_uiLibraryDoor; - case DATA_GO_MASSIVE_DOOR: return m_uiMassiveDoor; - case DATA_GO_SIDE_ENTRANCE_DOOR: return m_uiSideEntranceDoor; - case DATA_GO_GAME_DOOR: return m_uiGamesmansDoor; - case DATA_GO_GAME_EXIT_DOOR: return m_uiGamesmansExitDoor; - case DATA_GO_NETHER_DOOR: return m_uiNetherspaceDoor; - case DATA_MASTERS_TERRACE_DOOR_1: return MastersTerraceDoor[0]; - case DATA_MASTERS_TERRACE_DOOR_2: return MastersTerraceDoor[1]; + switch (uiData) + { + case TYPE_ATTUMEN: return m_auiEncounter[0]; + case TYPE_MOROES: return m_auiEncounter[1]; + case TYPE_MAIDEN: return m_auiEncounter[2]; + case TYPE_OPTIONAL_BOSS: return m_auiEncounter[3]; + case TYPE_OPERA: return m_auiEncounter[4]; + case TYPE_CURATOR: return m_auiEncounter[5]; + case TYPE_ARAN: return m_auiEncounter[6]; + case TYPE_TERESTIAN: return m_auiEncounter[7]; + case TYPE_NETHERSPITE: return m_auiEncounter[8]; + case TYPE_CHESS: return m_auiEncounter[9]; + case TYPE_MALCHEZZAR: return m_auiEncounter[10]; + case TYPE_NIGHTBANE: return m_auiEncounter[11]; + case DATA_OPERA_PERFORMANCE: return m_uiOperaEvent; + case DATA_OPERA_OZ_DEATHCOUNT: return m_uiOzDeathCount; + case DATA_IMAGE_OF_MEDIVH: return ImageGUID; + } + + return 0; } - return 0; - } - - void Load(const char* chrIn) - { - if (!chrIn) + uint64 GetData64(uint32 uiData) { - OUT_LOAD_INST_DATA_FAIL; - return; + switch (uiData) + { + case DATA_KILREK: return m_uiKilrekGUID; + case DATA_TERESTIAN: return m_uiTerestianGUID; + case DATA_MOROES: return m_uiMoroesGUID; + case DATA_GO_STAGEDOORLEFT: return m_uiStageDoorLeftGUID; + case DATA_GO_STAGEDOORRIGHT: return m_uiStageDoorRightGUID; + case DATA_GO_CURTAINS: return m_uiCurtainGUID; + case DATA_GO_LIBRARY_DOOR: return m_uiLibraryDoor; + case DATA_GO_MASSIVE_DOOR: return m_uiMassiveDoor; + case DATA_GO_SIDE_ENTRANCE_DOOR: return m_uiSideEntranceDoor; + case DATA_GO_GAME_DOOR: return m_uiGamesmansDoor; + case DATA_GO_GAME_EXIT_DOOR: return m_uiGamesmansExitDoor; + case DATA_GO_NETHER_DOOR: return m_uiNetherspaceDoor; + case DATA_MASTERS_TERRACE_DOOR_1: return MastersTerraceDoor[0]; + case DATA_MASTERS_TERRACE_DOOR_2: return MastersTerraceDoor[1]; + } + + return 0; } - OUT_LOAD_INST_DATA(chrIn); - std::istringstream loadStream(chrIn); + void Load(const char* chrIn) + { + if (!chrIn) + { + OUT_LOAD_INST_DATA_FAIL; + return; + } + + OUT_LOAD_INST_DATA(chrIn); + std::istringstream loadStream(chrIn); + + 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] >> m_auiEncounter[9] >> m_auiEncounter[10] >> m_auiEncounter[11]; + 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; + } + }; - 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] >> m_auiEncounter[9] >> m_auiEncounter[10] >> m_auiEncounter[11]; - 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_karazhan(Map* pMap) -{ - return new instance_karazhan(pMap); -} void AddSC_instance_karazhan() { - Script *newscript; - newscript = new Script; - newscript->Name = "instance_karazhan"; - newscript->GetInstanceData = &GetInstanceData_instance_karazhan; - newscript->RegisterSelf(); + new instance_karazhan(); } - diff --git a/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp b/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp index 29e22d36047..fd5caf9295f 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp @@ -101,294 +101,302 @@ float Spawns[6][2]= #define SPAWN_Z 90.5 #define SPAWN_Y -1758 #define SPAWN_O 4.738 - -struct npc_barnesAI : public npc_escortAI +
class npc_barnes : public CreatureScript { - npc_barnesAI(Creature* c) : npc_escortAI(c) - { - RaidWiped = false; - m_uiEventId = 0; - pInstance = c->GetInstanceData(); - } - - ScriptedInstance* pInstance; - - uint64 m_uiSpotlightGUID; - - uint32 TalkCount; - uint32 TalkTimer; - uint32 WipeTimer; - uint32 m_uiEventId; +public: + npc_barnes() : CreatureScript("npc_barnes") { } - bool PerformanceReady; - bool RaidWiped; - - void Reset() + struct npc_barnesAI : public npc_escortAI { - m_uiSpotlightGUID = 0; - - TalkCount = 0; - TalkTimer = 2000; - WipeTimer = 5000; - - PerformanceReady = false; - - if (pInstance) - m_uiEventId = pInstance->GetData(DATA_OPERA_PERFORMANCE); - } + npc_barnesAI(Creature* c) : npc_escortAI(c) + { + RaidWiped = false; + m_uiEventId = 0; + pInstance = c->GetInstanceScript(); + } - void StartEvent() - { - if (!pInstance) - return; + InstanceScript* pInstance; - pInstance->SetData(TYPE_OPERA, IN_PROGRESS); + uint64 m_uiSpotlightGUID; - //resets count for this event, in case earlier failed - if (m_uiEventId == EVENT_OZ) - pInstance->SetData(DATA_OPERA_OZ_DEATHCOUNT, IN_PROGRESS); + uint32 TalkCount; + uint32 TalkTimer; + uint32 WipeTimer; + uint32 m_uiEventId; - Start(false, false); - } + bool PerformanceReady; + bool RaidWiped; - void EnterCombat(Unit* /*who*/) {} + void Reset() + { + m_uiSpotlightGUID = 0; - void WaypointReached(uint32 i) - { - if (!pInstance) - return; + TalkCount = 0; + TalkTimer = 2000; + WipeTimer = 5000; - switch(i) - { - case 0: - DoCast(me, SPELL_TUXEDO, false); - pInstance->DoUseDoorOrButton(pInstance->GetData64(DATA_GO_STAGEDOORLEFT)); - break; - case 4: - TalkCount = 0; - SetEscortPaused(true); + PerformanceReady = false; - if (Creature* pSpotlight = me->SummonCreature(CREATURE_SPOTLIGHT, - me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0.0f, - TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 60000)) - { - pSpotlight->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - pSpotlight->CastSpell(pSpotlight, SPELL_SPOTLIGHT, false); - m_uiSpotlightGUID = pSpotlight->GetGUID(); - } - break; - case 8: - pInstance->DoUseDoorOrButton(pInstance->GetData64(DATA_GO_STAGEDOORLEFT)); - PerformanceReady = true; - break; - case 9: - PrepareEncounter(); - pInstance->DoUseDoorOrButton(pInstance->GetData64(DATA_GO_CURTAINS)); - break; + if (pInstance) + m_uiEventId = pInstance->GetData(DATA_OPERA_PERFORMANCE); } - } - void Talk(uint32 count) - { - int32 text = 0; - - switch(m_uiEventId) + void StartEvent() { - case EVENT_OZ: - if (OzDialogue[count].textid) - text = OzDialogue[count].textid; - if (OzDialogue[count].timer) - TalkTimer = OzDialogue[count].timer; - break; + if (!pInstance) + return; - case EVENT_HOOD: - if (HoodDialogue[count].textid) - text = HoodDialogue[count].textid; - if (HoodDialogue[count].timer) - TalkTimer = HoodDialogue[count].timer; - break; + pInstance->SetData(TYPE_OPERA, IN_PROGRESS); - case EVENT_RAJ: - if (RAJDialogue[count].textid) - text = RAJDialogue[count].textid; - if (RAJDialogue[count].timer) - TalkTimer = RAJDialogue[count].timer; - break; + //resets count for this event, in case earlier failed + if (m_uiEventId == EVENT_OZ) + pInstance->SetData(DATA_OPERA_OZ_DEATHCOUNT, IN_PROGRESS); + + Start(false, false); } - if (text) - DoScriptText(text, me); - } + void EnterCombat(Unit* /*who*/) {} - void PrepareEncounter() - { - sLog.outDebug("TSCR: Barnes Opera Event - Introduction complete - preparing encounter %d", m_uiEventId); - uint8 index = 0; - uint8 count = 0; - - switch(m_uiEventId) + void WaypointReached(uint32 i) { - case EVENT_OZ: - index = 0; - count = 4; - break; - case EVENT_HOOD: - index = 4; - count = index+1; - break; - case EVENT_RAJ: - index = 5; - count = index+1; - break; + if (!pInstance) + return; + + switch(i) + { + case 0: + DoCast(me, SPELL_TUXEDO, false); + pInstance->DoUseDoorOrButton(pInstance->GetData64(DATA_GO_STAGEDOORLEFT)); + break; + case 4: + TalkCount = 0; + SetEscortPaused(true); + + if (Creature* pSpotlight = me->SummonCreature(CREATURE_SPOTLIGHT, + me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0.0f, + TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 60000)) + { + pSpotlight->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + pSpotlight->CastSpell(pSpotlight, SPELL_SPOTLIGHT, false); + m_uiSpotlightGUID = pSpotlight->GetGUID(); + } + break; + case 8: + pInstance->DoUseDoorOrButton(pInstance->GetData64(DATA_GO_STAGEDOORLEFT)); + PerformanceReady = true; + break; + case 9: + PrepareEncounter(); + pInstance->DoUseDoorOrButton(pInstance->GetData64(DATA_GO_CURTAINS)); + break; + } } - for (; index < count; ++index) + void Talk(uint32 count) { - uint32 entry = ((uint32)Spawns[index][0]); - float PosX = Spawns[index][1]; + int32 text = 0; - if (Creature* pCreature = me->SummonCreature(entry, PosX, SPAWN_Y, SPAWN_Z, SPAWN_O, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, HOUR*2*IN_MILLISECONDS)) + switch(m_uiEventId) { - // In case database has bad flags - pCreature->SetUInt32Value(UNIT_FIELD_FLAGS, 0); - pCreature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + case EVENT_OZ: + if (OzDialogue[count].textid) + text = OzDialogue[count].textid; + if (OzDialogue[count].timer) + TalkTimer = OzDialogue[count].timer; + break; + + case EVENT_HOOD: + if (HoodDialogue[count].textid) + text = HoodDialogue[count].textid; + if (HoodDialogue[count].timer) + TalkTimer = HoodDialogue[count].timer; + break; + + case EVENT_RAJ: + if (RAJDialogue[count].textid) + text = RAJDialogue[count].textid; + if (RAJDialogue[count].timer) + TalkTimer = RAJDialogue[count].timer; + break; } + + if (text) + DoScriptText(text, me); } - RaidWiped = false; - } + void PrepareEncounter() + { + sLog.outDebug("TSCR: Barnes Opera Event - Introduction complete - preparing encounter %d", m_uiEventId); + uint8 index = 0; + uint8 count = 0; - void UpdateAI(const uint32 diff) - { - npc_escortAI::UpdateAI(diff); + switch(m_uiEventId) + { + case EVENT_OZ: + index = 0; + count = 4; + break; + case EVENT_HOOD: + index = 4; + count = index+1; + break; + case EVENT_RAJ: + index = 5; + count = index+1; + break; + } - if (HasEscortState(STATE_ESCORT_PAUSED)) - { - if (TalkTimer <= diff) + for (; index < count; ++index) { - if (TalkCount > 3) - { - if (Creature* pSpotlight = Unit::GetCreature(*me, m_uiSpotlightGUID)) - pSpotlight->ForcedDespawn(); + uint32 entry = ((uint32)Spawns[index][0]); + float PosX = Spawns[index][1]; - SetEscortPaused(false); - return; + if (Creature* pCreature = me->SummonCreature(entry, PosX, SPAWN_Y, SPAWN_Z, SPAWN_O, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, HOUR*2*IN_MILLISECONDS)) + { + // In case database has bad flags + pCreature->SetUInt32Value(UNIT_FIELD_FLAGS, 0); + pCreature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); } + } - Talk(TalkCount); - ++TalkCount; - } else TalkTimer -= diff; + RaidWiped = false; } - if (PerformanceReady) + void UpdateAI(const uint32 diff) { - if (!RaidWiped) + npc_escortAI::UpdateAI(diff); + + if (HasEscortState(STATE_ESCORT_PAUSED)) { - if (WipeTimer <= diff) + if (TalkTimer <= diff) { - Map* pMap = me->GetMap(); - if (!pMap->IsDungeon()) - return; + if (TalkCount > 3) + { + if (Creature* pSpotlight = Unit::GetCreature(*me, m_uiSpotlightGUID)) + pSpotlight->ForcedDespawn(); - Map::PlayerList const &PlayerList = pMap->GetPlayers(); - if (PlayerList.isEmpty()) + SetEscortPaused(false); return; + } - RaidWiped = true; - for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) + Talk(TalkCount); + ++TalkCount; + } else TalkTimer -= diff; + } + + if (PerformanceReady) + { + if (!RaidWiped) + { + if (WipeTimer <= diff) { - if (i->getSource()->isAlive() && !i->getSource()->isGameMaster()) + Map* pMap = me->GetMap(); + if (!pMap->IsDungeon()) + return; + + Map::PlayerList const &PlayerList = pMap->GetPlayers(); + if (PlayerList.isEmpty()) + return; + + RaidWiped = true; + for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) { - RaidWiped = false; - break; + if (i->getSource()->isAlive() && !i->getSource()->isGameMaster()) + { + RaidWiped = false; + break; + } } - } - if (RaidWiped) - { - RaidWiped = true; - EnterEvadeMode(); - return; - } + if (RaidWiped) + { + RaidWiped = true; + EnterEvadeMode(); + return; + } + + WipeTimer = 15000; + } else WipeTimer -= diff; + } - WipeTimer = 15000; - } else WipeTimer -= diff; } + } + }; + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) + { + npc_barnesAI* pBarnesAI = CAST_AI(npc_barnes::npc_barnesAI, pCreature->AI()); + + switch(uiAction) + { + case GOSSIP_ACTION_INFO_DEF+1: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, OZ_GOSSIP2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); + pPlayer->SEND_GOSSIP_MENU(8971, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+2: + pPlayer->CLOSE_GOSSIP_MENU(); + pBarnesAI->StartEvent(); + break; + case GOSSIP_ACTION_INFO_DEF+3: + pPlayer->CLOSE_GOSSIP_MENU(); + pBarnesAI->m_uiEventId = EVENT_OZ; + sLog.outString("TSCR: player (GUID %i) manually set Opera event to EVENT_OZ",pPlayer->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+4: + pPlayer->CLOSE_GOSSIP_MENU(); + pBarnesAI->m_uiEventId = EVENT_HOOD; + sLog.outString("TSCR: player (GUID %i) manually set Opera event to EVENT_HOOD",pPlayer->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+5: + pPlayer->CLOSE_GOSSIP_MENU(); + pBarnesAI->m_uiEventId = EVENT_RAJ; + sLog.outString("TSCR: player (GUID %i) manually set Opera event to EVENT_RAJ",pPlayer->GetGUID()); + break; } - } -}; -CreatureAI* GetAI_npc_barnesAI(Creature* pCreature) -{ - return new npc_barnesAI(pCreature); -} + return true; + } -bool GossipHello_npc_barnes(Player* pPlayer, Creature* pCreature) -{ - if (ScriptedInstance* pInstance = pCreature->GetInstanceData()) + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - // Check for death of Moroes and if opera event is not done already - if (pInstance->GetData(TYPE_MOROES) == DONE && pInstance->GetData(TYPE_OPERA) != DONE) + if (InstanceScript* pInstance = pCreature->GetInstanceScript()) { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, OZ_GOSSIP1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - - if (pPlayer->isGameMaster()) + // Check for death of Moroes and if opera event is not done already + if (pInstance->GetData(TYPE_MOROES) == DONE && pInstance->GetData(TYPE_OPERA) != DONE) { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, OZ_GM_GOSSIP1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, OZ_GM_GOSSIP2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, OZ_GM_GOSSIP3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5); - } + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, OZ_GOSSIP1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - if (npc_barnesAI* pBarnesAI = CAST_AI(npc_barnesAI,pCreature->AI())) - { - if (!pBarnesAI->RaidWiped) - pPlayer->SEND_GOSSIP_MENU(8970, pCreature->GetGUID()); - else - pPlayer->SEND_GOSSIP_MENU(8975, pCreature->GetGUID()); + if (pPlayer->isGameMaster()) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, OZ_GM_GOSSIP1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, OZ_GM_GOSSIP2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, OZ_GM_GOSSIP3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5); + } + + if (npc_barnesAI* pBarnesAI = CAST_AI(npc_barnes::npc_barnesAI,pCreature->AI())) + { + if (!pBarnesAI->RaidWiped) + pPlayer->SEND_GOSSIP_MENU(8970, pCreature->GetGUID()); + else + pPlayer->SEND_GOSSIP_MENU(8975, pCreature->GetGUID()); - return true; + return true; + } } } - } - - pPlayer->SEND_GOSSIP_MENU(8978, pCreature->GetGUID()); - return true; -} -bool GossipSelect_npc_barnes(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - npc_barnesAI* pBarnesAI = CAST_AI(npc_barnesAI, pCreature->AI()); + pPlayer->SEND_GOSSIP_MENU(8978, pCreature->GetGUID()); + return true; + } - switch(uiAction) + CreatureAI* GetAI(Creature* pCreature) const { - case GOSSIP_ACTION_INFO_DEF+1: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, OZ_GOSSIP2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); - pPlayer->SEND_GOSSIP_MENU(8971, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+2: - pPlayer->CLOSE_GOSSIP_MENU(); - pBarnesAI->StartEvent(); - break; - case GOSSIP_ACTION_INFO_DEF+3: - pPlayer->CLOSE_GOSSIP_MENU(); - pBarnesAI->m_uiEventId = EVENT_OZ; - sLog.outString("TSCR: player (GUID %i) manually set Opera event to EVENT_OZ",pPlayer->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+4: - pPlayer->CLOSE_GOSSIP_MENU(); - pBarnesAI->m_uiEventId = EVENT_HOOD; - sLog.outString("TSCR: player (GUID %i) manually set Opera event to EVENT_HOOD",pPlayer->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+5: - pPlayer->CLOSE_GOSSIP_MENU(); - pBarnesAI->m_uiEventId = EVENT_RAJ; - sLog.outString("TSCR: player (GUID %i) manually set Opera event to EVENT_RAJ",pPlayer->GetGUID()); - break; + return new npc_barnesAI(pCreature); } - return true; -} +}; + + /*### # npc_berthold @@ -400,28 +408,35 @@ enum eBerthold }; #define GOSSIP_ITEM_TELEPORT "Teleport me to the Guardian's Library" - -bool GossipHello_npc_berthold(Player* pPlayer, Creature* pCreature) +
class npc_berthold : public CreatureScript { - if (ScriptedInstance* pInstance = pCreature->GetInstanceData()) +public: + npc_berthold() : CreatureScript("npc_berthold") { } + + bool OnGossipSelect(Player* pPlayer, Creature* /*pCreature*/, uint32 /*uiSender*/, uint32 uiAction) { - // Check if Shade of Aran event is done - if (pInstance->GetData(TYPE_ARAN) == DONE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_TELEPORT, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + if (uiAction == GOSSIP_ACTION_INFO_DEF + 1) + pPlayer->CastSpell(pPlayer, SPELL_TELEPORT, true); + + pPlayer->CLOSE_GOSSIP_MENU(); + return true; } - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - return true; -} + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (InstanceScript* pInstance = pCreature->GetInstanceScript()) + { + // Check if Shade of Aran event is done + if (pInstance->GetData(TYPE_ARAN) == DONE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_TELEPORT, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + } -bool GossipSelect_npc_berthold(Player* pPlayer, Creature* /*pCreature*/, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF + 1) - pPlayer->CastSpell(pPlayer, SPELL_TELEPORT, true); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + return true; + } + +}; - pPlayer->CLOSE_GOSSIP_MENU(); - return true; -} /*### # npc_image_of_medivh @@ -445,204 +460,194 @@ bool GossipSelect_npc_berthold(Player* pPlayer, Creature* /*pCreature*/, uint32 static float MedivPos[4] = {-11161.49,-1902.24,91.48,1.94}; static float ArcanagosPos[4] = {-11169.75,-1881.48,95.39,4.83}; - -struct npc_image_of_medivhAI : public ScriptedAI +
class npc_image_of_medivh : public CreatureScript { - npc_image_of_medivhAI(Creature* c) : ScriptedAI(c) +public: + npc_image_of_medivh() : CreatureScript("npc_image_of_medivh") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new npc_image_of_medivhAI(pCreature); } - ScriptedInstance *pInstance; + struct npc_image_of_medivhAI : public ScriptedAI + { + npc_image_of_medivhAI(Creature* c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } - uint64 ArcanagosGUID; + InstanceScript *pInstance; - uint32 YellTimer; - uint32 Step; - uint32 FireMedivhTimer; - uint32 FireArcanagosTimer; + uint64 ArcanagosGUID; - bool EventStarted; + uint32 YellTimer; + uint32 Step; + uint32 FireMedivhTimer; + uint32 FireArcanagosTimer; - void Reset() - { - ArcanagosGUID = 0; + bool EventStarted; - if (pInstance && pInstance->GetData64(DATA_IMAGE_OF_MEDIVH) == 0) + void Reset() { - pInstance->SetData64(DATA_IMAGE_OF_MEDIVH, me->GetGUID()); - (*me).GetMotionMaster()->MovePoint(1,MedivPos[0],MedivPos[1],MedivPos[2]); - Step = 0; - }else + ArcanagosGUID = 0; + + if (pInstance && pInstance->GetData64(DATA_IMAGE_OF_MEDIVH) == 0) + { + pInstance->SetData64(DATA_IMAGE_OF_MEDIVH, me->GetGUID()); + (*me).GetMotionMaster()->MovePoint(1,MedivPos[0],MedivPos[1],MedivPos[2]); + Step = 0; + }else + { + me->DealDamage(me,me->GetHealth(),NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + me->RemoveCorpse(); + } + } + void EnterCombat(Unit* /*who*/) {} + + void MovementInform(uint32 type, uint32 id) { - me->DealDamage(me,me->GetHealth(),NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); - me->RemoveCorpse(); + if (type != POINT_MOTION_TYPE) + return; + if (id == 1) + { + StartEvent(); + me->SetOrientation(MedivPos[3]); + me->SetOrientation(MedivPos[3]); + } } - } - void EnterCombat(Unit* /*who*/) {} - void MovementInform(uint32 type, uint32 id) - { - if (type != POINT_MOTION_TYPE) - return; - if (id == 1) + void StartEvent() { - StartEvent(); - me->SetOrientation(MedivPos[3]); + Step = 1; + EventStarted = true; + Creature* Arcanagos = me->SummonCreature(MOB_ARCANAGOS,ArcanagosPos[0],ArcanagosPos[1],ArcanagosPos[2],0,TEMPSUMMON_CORPSE_TIMED_DESPAWN,20000); + if (!Arcanagos) + return; + ArcanagosGUID = Arcanagos->GetGUID(); + Arcanagos->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + (*Arcanagos).GetMotionMaster()->MovePoint(0,ArcanagosPos[0],ArcanagosPos[1],ArcanagosPos[2]); + Arcanagos->SetOrientation(ArcanagosPos[3]); me->SetOrientation(MedivPos[3]); + YellTimer = 10000; } - } - - void StartEvent() - { - Step = 1; - EventStarted = true; - Creature* Arcanagos = me->SummonCreature(MOB_ARCANAGOS,ArcanagosPos[0],ArcanagosPos[1],ArcanagosPos[2],0,TEMPSUMMON_CORPSE_TIMED_DESPAWN,20000); - if (!Arcanagos) - return; - ArcanagosGUID = Arcanagos->GetGUID(); - Arcanagos->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); - (*Arcanagos).GetMotionMaster()->MovePoint(0,ArcanagosPos[0],ArcanagosPos[1],ArcanagosPos[2]); - Arcanagos->SetOrientation(ArcanagosPos[3]); - me->SetOrientation(MedivPos[3]); - YellTimer = 10000; - } - uint32 NextStep(uint32 Step) - { - Unit* arca = Unit::GetUnit((*me),ArcanagosGUID); - Map* pMap = me->GetMap(); - switch(Step) + uint32 NextStep(uint32 Step) { - case 0: return 9999999; - case 1: - me->MonsterYell(SAY_DIALOG_MEDIVH_1,LANG_UNIVERSAL,NULL); - return 10000; - case 2: - if (arca) - CAST_CRE(arca)->MonsterYell(SAY_DIALOG_ARCANAGOS_2,LANG_UNIVERSAL,NULL); - return 20000; - case 3: - me->MonsterYell(SAY_DIALOG_MEDIVH_3,LANG_UNIVERSAL,NULL); - return 10000; - case 4: - if (arca) - CAST_CRE(arca)->MonsterYell(SAY_DIALOG_ARCANAGOS_4, LANG_UNIVERSAL, NULL); - return 20000; - case 5: - me->MonsterYell(SAY_DIALOG_MEDIVH_5, LANG_UNIVERSAL, NULL); - return 20000; - case 6: - if (arca) - CAST_CRE(arca)->MonsterYell(SAY_DIALOG_ARCANAGOS_6, LANG_UNIVERSAL, NULL); - return 10000; - case 7: - FireArcanagosTimer = 500; - return 5000; - case 8: - FireMedivhTimer = 500; - DoCast(me, SPELL_MANA_SHIELD); - return 10000; - case 9: - me->MonsterTextEmote(EMOTE_DIALOG_MEDIVH_7, 0, false); - return 10000; - case 10: - if (arca) - DoCast(arca, SPELL_CONFLAGRATION_BLAST, false); - return 1000; - case 11: - if (arca) - CAST_CRE(arca)->MonsterYell(SAY_DIALOG_ARCANAGOS_8, LANG_UNIVERSAL, NULL); - return 5000; - case 12: - arca->GetMotionMaster()->MovePoint(0, -11010.82,-1761.18, 156.47); - arca->setActive(true); - arca->InterruptNonMeleeSpells(true); - arca->SetSpeed(MOVE_FLIGHT, 2.0f); - return 10000; - case 13: - me->MonsterYell(SAY_DIALOG_MEDIVH_9, LANG_UNIVERSAL, NULL); - return 10000; - case 14: - me->SetVisibility(VISIBILITY_OFF); - me->ClearInCombat(); - - if (pMap->IsDungeon()) + Unit* arca = Unit::GetUnit((*me),ArcanagosGUID); + Map* pMap = me->GetMap(); + switch(Step) { - InstanceMap::PlayerList const &PlayerList = pMap->GetPlayers(); - for (InstanceMap::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) + case 0: return 9999999; + case 1: + me->MonsterYell(SAY_DIALOG_MEDIVH_1,LANG_UNIVERSAL,NULL); + return 10000; + case 2: + if (arca) + CAST_CRE(arca)->MonsterYell(SAY_DIALOG_ARCANAGOS_2,LANG_UNIVERSAL,NULL); + return 20000; + case 3: + me->MonsterYell(SAY_DIALOG_MEDIVH_3,LANG_UNIVERSAL,NULL); + return 10000; + case 4: + if (arca) + CAST_CRE(arca)->MonsterYell(SAY_DIALOG_ARCANAGOS_4, LANG_UNIVERSAL, NULL); + return 20000; + case 5: + me->MonsterYell(SAY_DIALOG_MEDIVH_5, LANG_UNIVERSAL, NULL); + return 20000; + case 6: + if (arca) + CAST_CRE(arca)->MonsterYell(SAY_DIALOG_ARCANAGOS_6, LANG_UNIVERSAL, NULL); + return 10000; + case 7: + FireArcanagosTimer = 500; + return 5000; + case 8: + FireMedivhTimer = 500; + DoCast(me, SPELL_MANA_SHIELD); + return 10000; + case 9: + me->MonsterTextEmote(EMOTE_DIALOG_MEDIVH_7, 0, false); + return 10000; + case 10: + if (arca) + DoCast(arca, SPELL_CONFLAGRATION_BLAST, false); + return 1000; + case 11: + if (arca) + CAST_CRE(arca)->MonsterYell(SAY_DIALOG_ARCANAGOS_8, LANG_UNIVERSAL, NULL); + return 5000; + case 12: + arca->GetMotionMaster()->MovePoint(0, -11010.82,-1761.18, 156.47); + arca->setActive(true); + arca->InterruptNonMeleeSpells(true); + arca->SetSpeed(MOVE_FLIGHT, 2.0f); + return 10000; + case 13: + me->MonsterYell(SAY_DIALOG_MEDIVH_9, LANG_UNIVERSAL, NULL); + return 10000; + case 14: + me->SetVisibility(VISIBILITY_OFF); + me->ClearInCombat(); + + if (pMap->IsDungeon()) { - if (i->getSource()->isAlive()) + InstanceMap::PlayerList const &PlayerList = pMap->GetPlayers(); + for (InstanceMap::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) { - if (i->getSource()->GetQuestStatus(9645) == QUEST_STATUS_INCOMPLETE) - i->getSource()->CompleteQuest(9645); + if (i->getSource()->isAlive()) + { + if (i->getSource()->GetQuestStatus(9645) == QUEST_STATUS_INCOMPLETE) + i->getSource()->CompleteQuest(9645); + } } } + return 50000; + case 15: + arca->DealDamage(arca,arca->GetHealth(),NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + return 5000; + default : return 9999999; } - return 50000; - case 15: - arca->DealDamage(arca,arca->GetHealth(),NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); - return 5000; - default : return 9999999; - } - - } - - void UpdateAI(const uint32 diff) - { - if (YellTimer <= diff) - { - if (EventStarted) - YellTimer = NextStep(Step++); - } else YellTimer -= diff; + } - if (Step >= 7 && Step <= 12) + void UpdateAI(const uint32 diff) { - Unit* arca = Unit::GetUnit((*me),ArcanagosGUID); - if (FireArcanagosTimer <= diff) + if (YellTimer <= diff) { - if (arca) - arca->CastSpell(me, SPELL_FIRE_BALL, false); - FireArcanagosTimer = 6000; - } else FireArcanagosTimer -= diff; + if (EventStarted) + YellTimer = NextStep(Step++); + } else YellTimer -= diff; - if (FireMedivhTimer <= diff) + if (Step >= 7 && Step <= 12) { - if (arca) - DoCast(arca, SPELL_FIRE_BALL); - FireMedivhTimer = 5000; - } else FireMedivhTimer -= diff; + Unit* arca = Unit::GetUnit((*me),ArcanagosGUID); + + if (FireArcanagosTimer <= diff) + { + if (arca) + arca->CastSpell(me, SPELL_FIRE_BALL, false); + FireArcanagosTimer = 6000; + } else FireArcanagosTimer -= diff; + + if (FireMedivhTimer <= diff) + { + if (arca) + DoCast(arca, SPELL_FIRE_BALL); + FireMedivhTimer = 5000; + } else FireMedivhTimer -= diff; + } } - } + }; + }; -CreatureAI* GetAI_npc_image_of_medivh(Creature* pCreature) -{ - return new npc_image_of_medivhAI(pCreature); -} void AddSC_karazhan() { - Script* newscript; - - newscript = new Script; - newscript->GetAI = &GetAI_npc_barnesAI; - newscript->Name = "npc_barnes"; - newscript->pGossipHello = &GossipHello_npc_barnes; - newscript->pGossipSelect = &GossipSelect_npc_barnes; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_berthold"; - newscript->pGossipHello = &GossipHello_npc_berthold; - newscript->pGossipSelect = &GossipSelect_npc_berthold; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_image_of_medivh"; - newscript->GetAI = &GetAI_npc_image_of_medivh; - newscript->RegisterSelf(); + new npc_barnes(); + new npc_berthold(); + new npc_image_of_medivh(); } - diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp index 3f0cffbacaa..582add3c1c8 100644 --- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp +++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp @@ -76,607 +76,620 @@ float KaelLocations[3][2]= }; #define LOCATION_Z -16.727455 - -struct boss_felblood_kaelthasAI : public ScriptedAI +
class boss_felblood_kaelthas : public CreatureScript { - boss_felblood_kaelthasAI(Creature* c) : ScriptedAI(c) +public: + boss_felblood_kaelthas() : CreatureScript("boss_felblood_kaelthas") { } + + CreatureAI* GetAI(Creature* c) { - pInstance = c->GetInstanceData(); + return new boss_felblood_kaelthasAI(c); } - ScriptedInstance* pInstance; - - uint32 FireballTimer; - uint32 PhoenixTimer; - uint32 FlameStrikeTimer; - uint32 CombatPulseTimer; - - //Heroic only - uint32 PyroblastTimer; + struct boss_felblood_kaelthasAI : public ScriptedAI + { + boss_felblood_kaelthasAI(Creature* c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } - uint32 GravityLapseTimer; - uint32 GravityLapsePhase; - // 0 = No Gravity Lapse - // 1 = Casting Gravity Lapse visual - // 2 = Teleported people to self - // 3 = Knocked people up in the air - // 4 = Applied an aura that allows them to fly, channeling visual, relased Arcane Orbs. + InstanceScript* pInstance; - bool FirstGravityLapse; - bool HasTaunted; + uint32 FireballTimer; + uint32 PhoenixTimer; + uint32 FlameStrikeTimer; + uint32 CombatPulseTimer; - uint8 Phase; - // 0 = Not started - // 1 = Fireball; Summon Phoenix; Flamestrike - // 2 = Gravity Lapses + //Heroic only + uint32 PyroblastTimer; - void Reset() - { - // TODO: Timers - FireballTimer = 0; - PhoenixTimer = 10000; - FlameStrikeTimer = 25000; - CombatPulseTimer = 0; + uint32 GravityLapseTimer; + uint32 GravityLapsePhase; + // 0 = No Gravity Lapse + // 1 = Casting Gravity Lapse visual + // 2 = Teleported people to self + // 3 = Knocked people up in the air + // 4 = Applied an aura that allows them to fly, channeling visual, relased Arcane Orbs. - PyroblastTimer = 60000; + bool FirstGravityLapse; + bool HasTaunted; - GravityLapseTimer = 0; - GravityLapsePhase = 0; + uint8 Phase; + // 0 = Not started + // 1 = Fireball; Summon Phoenix; Flamestrike + // 2 = Gravity Lapses - FirstGravityLapse = true; - HasTaunted = false; + void Reset() + { + // TODO: Timers + FireballTimer = 0; + PhoenixTimer = 10000; + FlameStrikeTimer = 25000; + CombatPulseTimer = 0; - Phase = 0; + PyroblastTimer = 60000; - if (pInstance) - { - pInstance->SetData(DATA_KAELTHAS_EVENT, NOT_STARTED); - pInstance->HandleGameObject(pInstance->GetData64(DATA_KAEL_DOOR), true); - // Open the big encounter door. Close it in Aggro and open it only in JustDied(and here) - // Small door opened after event are expected to be closed by default - } - } + GravityLapseTimer = 0; + GravityLapsePhase = 0; - void JustDied(Unit * /*killer*/) - { - DoScriptText(SAY_DEATH, me); + FirstGravityLapse = true; + HasTaunted = false; - if (!pInstance) - return; + Phase = 0; - pInstance->HandleGameObject(pInstance->GetData64(DATA_KAEL_DOOR), true); - // Open the encounter door - } + if (pInstance) + { + pInstance->SetData(DATA_KAELTHAS_EVENT, NOT_STARTED); + pInstance->HandleGameObject(pInstance->GetData64(DATA_KAEL_DOOR), true); + // Open the big encounter door. Close it in Aggro and open it only in JustDied(and here) + // Small door opened after event are expected to be closed by default + } + } - void DamageTaken(Unit* /*done_by*/, uint32 &damage) - { - if (damage > me->GetHealth()) - RemoveGravityLapse(); // Remove Gravity Lapse so that players fall to ground if they kill him when in air. - } + void JustDied(Unit * /*killer*/) + { + DoScriptText(SAY_DEATH, me); - void EnterCombat(Unit * /*who*/) - { - if (!pInstance) - return; + if (!pInstance) + return; - pInstance->HandleGameObject(pInstance->GetData64(DATA_KAEL_DOOR), false); - //Close the encounter door, open it in JustDied/Reset - } + pInstance->HandleGameObject(pInstance->GetData64(DATA_KAEL_DOOR), true); + // Open the encounter door + } - void MoveInLineOfSight(Unit *who) - { - if (!HasTaunted && me->IsWithinDistInMap(who, 40.0)) + void DamageTaken(Unit* /*done_by*/, uint32 &damage) { - DoScriptText(SAY_AGGRO, me); - HasTaunted = true; + if (damage > me->GetHealth()) + RemoveGravityLapse(); // Remove Gravity Lapse so that players fall to ground if they kill him when in air. } - ScriptedAI::MoveInLineOfSight(who); - } + void EnterCombat(Unit * /*who*/) + { + if (!pInstance) + return; - void SetThreatList(Creature* SummonedUnit) - { - if (!SummonedUnit) - return; + pInstance->HandleGameObject(pInstance->GetData64(DATA_KAEL_DOOR), false); + //Close the encounter door, open it in JustDied/Reset + } - 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) + void MoveInLineOfSight(Unit *who) { - Unit* pUnit = Unit::GetUnit((*me), (*i)->getUnitGuid()); - if (pUnit && pUnit->isAlive()) + if (!HasTaunted && me->IsWithinDistInMap(who, 40.0)) { - float threat = me->getThreatManager().getThreat(pUnit); - SummonedUnit->AddThreat(pUnit, threat); + DoScriptText(SAY_AGGRO, me); + HasTaunted = true; } + + ScriptedAI::MoveInLineOfSight(who); } - } - void TeleportPlayersToSelf() - { - float x = KaelLocations[0][0]; - float y = KaelLocations[0][1]; - me->GetMap()->CreatureRelocation(me, x, y, LOCATION_Z, 0.0f); - //me->SendMonsterMove(x, y, LOCATION_Z, 0, 0, 0); // causes some issues... - std::list<HostileReference*>::const_iterator i = me->getThreatManager().getThreatList().begin(); - for (i = me->getThreatManager().getThreatList().begin(); i!= me->getThreatManager().getThreatList().end(); ++i) + void SetThreatList(Creature* SummonedUnit) { - Unit* pUnit = Unit::GetUnit((*me), (*i)->getUnitGuid()); - if (pUnit && (pUnit->GetTypeId() == TYPEID_PLAYER)) - pUnit->CastSpell(pUnit, SPELL_TELEPORT_CENTER, true); + if (!SummonedUnit) + return; + + 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) + { + Unit* pUnit = Unit::GetUnit((*me), (*i)->getUnitGuid()); + if (pUnit && pUnit->isAlive()) + { + float threat = me->getThreatManager().getThreat(pUnit); + SummonedUnit->AddThreat(pUnit, threat); + } + } } - DoCast(me, SPELL_TELEPORT_CENTER, true); - } - void CastGravityLapseKnockUp() - { - std::list<HostileReference*>::const_iterator i = me->getThreatManager().getThreatList().begin(); - for (i = me->getThreatManager().getThreatList().begin(); i!= me->getThreatManager().getThreatList().end(); ++i) + void TeleportPlayersToSelf() { - Unit* pUnit = Unit::GetUnit((*me), (*i)->getUnitGuid()); - if (pUnit && (pUnit->GetTypeId() == TYPEID_PLAYER)) - // Knockback into the air - pUnit->CastSpell(pUnit, SPELL_GRAVITY_LAPSE_DOT, true, 0, 0, me->GetGUID()); + float x = KaelLocations[0][0]; + float y = KaelLocations[0][1]; + me->GetMap()->CreatureRelocation(me, x, y, LOCATION_Z, 0.0f); + //me->SendMonsterMove(x, y, LOCATION_Z, 0, 0, 0); // causes some issues... + std::list<HostileReference*>::const_iterator i = me->getThreatManager().getThreatList().begin(); + for (i = me->getThreatManager().getThreatList().begin(); i!= me->getThreatManager().getThreatList().end(); ++i) + { + Unit* pUnit = Unit::GetUnit((*me), (*i)->getUnitGuid()); + if (pUnit && (pUnit->GetTypeId() == TYPEID_PLAYER)) + pUnit->CastSpell(pUnit, SPELL_TELEPORT_CENTER, true); + } + DoCast(me, SPELL_TELEPORT_CENTER, true); } - } - void CastGravityLapseFly() // Use Fly Packet hack for now as players can't cast "fly" spells unless in map 530. Has to be done a while after they get knocked into the air... - { - std::list<HostileReference*>::const_iterator i = me->getThreatManager().getThreatList().begin(); - for (i = me->getThreatManager().getThreatList().begin(); i!= me->getThreatManager().getThreatList().end(); ++i) + void CastGravityLapseKnockUp() { - Unit* pUnit = Unit::GetUnit((*me), (*i)->getUnitGuid()); - if (pUnit && (pUnit->GetTypeId() == TYPEID_PLAYER)) + std::list<HostileReference*>::const_iterator i = me->getThreatManager().getThreatList().begin(); + for (i = me->getThreatManager().getThreatList().begin(); i!= me->getThreatManager().getThreatList().end(); ++i) { - // Also needs an exception in spell system. - pUnit->CastSpell(pUnit, SPELL_GRAVITY_LAPSE_FLY, true, 0, 0, me->GetGUID()); - // Use packet hack - WorldPacket data(12); - data.SetOpcode(SMSG_MOVE_SET_CAN_FLY); - data.append(pUnit->GetPackGUID()); - data << uint32(0); - pUnit->SendMessageToSet(&data, true); + Unit* pUnit = Unit::GetUnit((*me), (*i)->getUnitGuid()); + if (pUnit && (pUnit->GetTypeId() == TYPEID_PLAYER)) + // Knockback into the air + pUnit->CastSpell(pUnit, SPELL_GRAVITY_LAPSE_DOT, true, 0, 0, me->GetGUID()); } } - } - void RemoveGravityLapse() - { - std::list<HostileReference*>::const_iterator i = me->getThreatManager().getThreatList().begin(); - for (i = me->getThreatManager().getThreatList().begin(); i!= me->getThreatManager().getThreatList().end(); ++i) + void CastGravityLapseFly() // Use Fly Packet hack for now as players can't cast "fly" spells unless in map 530. Has to be done a while after they get knocked into the air... { - Unit* pUnit = Unit::GetUnit((*me), (*i)->getUnitGuid()); - if (pUnit && (pUnit->GetTypeId() == TYPEID_PLAYER)) + std::list<HostileReference*>::const_iterator i = me->getThreatManager().getThreatList().begin(); + for (i = me->getThreatManager().getThreatList().begin(); i!= me->getThreatManager().getThreatList().end(); ++i) { - pUnit->RemoveAurasDueToSpell(SPELL_GRAVITY_LAPSE_FLY); - pUnit->RemoveAurasDueToSpell(SPELL_GRAVITY_LAPSE_DOT); - - WorldPacket data(12); - data.SetOpcode(SMSG_MOVE_UNSET_CAN_FLY); - data.append(pUnit->GetPackGUID()); - data << uint32(0); - pUnit->SendMessageToSet(&data, true); + Unit* pUnit = Unit::GetUnit((*me), (*i)->getUnitGuid()); + if (pUnit && (pUnit->GetTypeId() == TYPEID_PLAYER)) + { + // Also needs an exception in spell system. + pUnit->CastSpell(pUnit, SPELL_GRAVITY_LAPSE_FLY, true, 0, 0, me->GetGUID()); + // Use packet hack + WorldPacket data(12); + data.SetOpcode(SMSG_MOVE_SET_CAN_FLY); + data.append(pUnit->GetPackGUID()); + data << uint32(0); + pUnit->SendMessageToSet(&data, true); + } } } - } - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - switch(Phase) + void RemoveGravityLapse() { - case 0: + std::list<HostileReference*>::const_iterator i = me->getThreatManager().getThreatList().begin(); + for (i = me->getThreatManager().getThreatList().begin(); i!= me->getThreatManager().getThreatList().end(); ++i) { - // *Heroic mode only: - if (IsHeroic()) + Unit* pUnit = Unit::GetUnit((*me), (*i)->getUnitGuid()); + if (pUnit && (pUnit->GetTypeId() == TYPEID_PLAYER)) { - if (PyroblastTimer <= diff) - { - me->InterruptSpell(CURRENT_CHANNELED_SPELL); - me->InterruptSpell(CURRENT_GENERIC_SPELL); - DoCast(me, SPELL_SHOCK_BARRIER, true); - DoCast(me->getVictim(), SPELL_PYROBLAST); - PyroblastTimer = 60000; - } else PyroblastTimer -= diff; + pUnit->RemoveAurasDueToSpell(SPELL_GRAVITY_LAPSE_FLY); + pUnit->RemoveAurasDueToSpell(SPELL_GRAVITY_LAPSE_DOT); + + WorldPacket data(12); + data.SetOpcode(SMSG_MOVE_UNSET_CAN_FLY); + data.append(pUnit->GetPackGUID()); + data << uint32(0); + pUnit->SendMessageToSet(&data, true); } + } + } - if (FireballTimer <= diff) - { - DoCast(me->getVictim(), SPELL_FIREBALL_NORMAL); - FireballTimer = urand(2000,6000); - } else FireballTimer -= diff; + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; - if (PhoenixTimer <= diff) + switch(Phase) + { + case 0: { + // *Heroic mode only: + if (IsHeroic()) + { + if (PyroblastTimer <= diff) + { + me->InterruptSpell(CURRENT_CHANNELED_SPELL); + me->InterruptSpell(CURRENT_GENERIC_SPELL); + DoCast(me, SPELL_SHOCK_BARRIER, true); + DoCast(me->getVictim(), SPELL_PYROBLAST); + PyroblastTimer = 60000; + } else PyroblastTimer -= diff; + } - Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,1); - - uint8 random = urand(1,2); - float x = KaelLocations[random][0]; - float y = KaelLocations[random][1]; + if (FireballTimer <= diff) + { + DoCast(me->getVictim(), SPELL_FIREBALL_NORMAL); + FireballTimer = urand(2000,6000); + } else FireballTimer -= diff; - Creature* Phoenix = me->SummonCreature(CREATURE_PHOENIX, x, y, LOCATION_Z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 60000); - if (Phoenix) + if (PhoenixTimer <= diff) { - Phoenix->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE + UNIT_FLAG_NON_ATTACKABLE); - SetThreatList(Phoenix); - Phoenix->AI()->AttackStart(pTarget); - } - DoScriptText(SAY_PHOENIX, me); + Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,1); - PhoenixTimer = 60000; - } else PhoenixTimer -= diff; + uint8 random = urand(1,2); + float x = KaelLocations[random][0]; + float y = KaelLocations[random][1]; - if (FlameStrikeTimer <= diff) - { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + Creature* Phoenix = me->SummonCreature(CREATURE_PHOENIX, x, y, LOCATION_Z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 60000); + if (Phoenix) + { + Phoenix->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE + UNIT_FLAG_NON_ATTACKABLE); + SetThreatList(Phoenix); + Phoenix->AI()->AttackStart(pTarget); + } + + DoScriptText(SAY_PHOENIX, me); + + PhoenixTimer = 60000; + } else PhoenixTimer -= diff; + + if (FlameStrikeTimer <= diff) + { + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + { + me->InterruptSpell(CURRENT_CHANNELED_SPELL); + me->InterruptSpell(CURRENT_GENERIC_SPELL); + DoCast(pTarget, SPELL_FLAMESTRIKE3, true); + DoScriptText(SAY_FLAMESTRIKE, me); + } + FlameStrikeTimer = urand(15000,25000); + } else FlameStrikeTimer -= diff; + + // Below 50% + if (me->GetMaxHealth() * 0.5 > me->GetHealth()) { - me->InterruptSpell(CURRENT_CHANNELED_SPELL); - me->InterruptSpell(CURRENT_GENERIC_SPELL); - DoCast(pTarget, SPELL_FLAMESTRIKE3, true); - DoScriptText(SAY_FLAMESTRIKE, me); + me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_INTERRUPT_CAST, true); + me->StopMoving(); + me->GetMotionMaster()->Clear(); + me->GetMotionMaster()->MoveIdle(); + GravityLapseTimer = 0; + GravityLapsePhase = 0; + Phase = 1; } - FlameStrikeTimer = urand(15000,25000); - } else FlameStrikeTimer -= diff; - // Below 50% - if (me->GetMaxHealth() * 0.5 > me->GetHealth()) - { - me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_INTERRUPT_CAST, true); - me->StopMoving(); - me->GetMotionMaster()->Clear(); - me->GetMotionMaster()->MoveIdle(); - GravityLapseTimer = 0; - GravityLapsePhase = 0; - Phase = 1; + DoMeleeAttackIfReady(); } + break; - DoMeleeAttackIfReady(); - } - break; - - case 1: - { - if (GravityLapseTimer <= diff) + case 1: { - switch(GravityLapsePhase) + if (GravityLapseTimer <= diff) { - case 0: - if (FirstGravityLapse) // Different yells at 50%, and at every following Gravity Lapse - { - DoScriptText(SAY_GRAVITY_LAPSE, me); - FirstGravityLapse = false; - - if (pInstance) + switch(GravityLapsePhase) + { + case 0: + if (FirstGravityLapse) // Different yells at 50%, and at every following Gravity Lapse { - pInstance->HandleGameObject(pInstance->GetData64(DATA_KAEL_STATUE_LEFT), true); - pInstance->HandleGameObject(pInstance->GetData64(DATA_KAEL_STATUE_RIGHT), true); - } - }else - { - DoScriptText(SAY_RECAST_GRAVITY, me); - } - - DoCast(me, SPELL_GRAVITY_LAPSE_INITIAL); - GravityLapseTimer = 2000 + diff;// Don't interrupt the visual spell - GravityLapsePhase = 1; - break; - - case 1: - TeleportPlayersToSelf(); - GravityLapseTimer = 1000; - GravityLapsePhase = 2; - break; - - case 2: - CastGravityLapseKnockUp(); - GravityLapseTimer = 1000; - GravityLapsePhase = 3; - break; - - case 3: - CastGravityLapseFly(); - GravityLapseTimer = 30000; - GravityLapsePhase = 4; - - for (uint8 i = 0; i < 3; ++i) - { - Unit *pTarget = NULL; - pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); - - Creature* Orb = DoSpawnCreature(CREATURE_ARCANE_SPHERE, 5, 5, 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 30000); - if (Orb && pTarget) + DoScriptText(SAY_GRAVITY_LAPSE, me); + FirstGravityLapse = false; + + if (pInstance) + { + pInstance->HandleGameObject(pInstance->GetData64(DATA_KAEL_STATUE_LEFT), true); + pInstance->HandleGameObject(pInstance->GetData64(DATA_KAEL_STATUE_RIGHT), true); + } + }else { - Orb->SetSpeed(MOVE_RUN, 0.5f); - Orb->AddThreat(pTarget, 1000000.0f); - Orb->AI()->AttackStart(pTarget); + DoScriptText(SAY_RECAST_GRAVITY, me); } - } + DoCast(me, SPELL_GRAVITY_LAPSE_INITIAL); + GravityLapseTimer = 2000 + diff;// Don't interrupt the visual spell + GravityLapsePhase = 1; + break; + + case 1: + TeleportPlayersToSelf(); + GravityLapseTimer = 1000; + GravityLapsePhase = 2; + break; + + case 2: + CastGravityLapseKnockUp(); + GravityLapseTimer = 1000; + GravityLapsePhase = 3; + break; + + case 3: + CastGravityLapseFly(); + GravityLapseTimer = 30000; + GravityLapsePhase = 4; + + for (uint8 i = 0; i < 3; ++i) + { + Unit *pTarget = NULL; + pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); - DoCast(me, SPELL_GRAVITY_LAPSE_CHANNEL); - break; + Creature* Orb = DoSpawnCreature(CREATURE_ARCANE_SPHERE, 5, 5, 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 30000); + if (Orb && pTarget) + { + Orb->SetSpeed(MOVE_RUN, 0.5f); + Orb->AddThreat(pTarget, 1000000.0f); + Orb->AI()->AttackStart(pTarget); + } - case 4: - me->InterruptNonMeleeSpells(false); - DoScriptText(SAY_TIRED, me); - DoCast(me, SPELL_POWER_FEEDBACK); - RemoveGravityLapse(); - GravityLapseTimer = 10000; - GravityLapsePhase = 0; - break; - } - } else GravityLapseTimer -= diff; + } + + DoCast(me, SPELL_GRAVITY_LAPSE_CHANNEL); + break; + + case 4: + me->InterruptNonMeleeSpells(false); + DoScriptText(SAY_TIRED, me); + DoCast(me, SPELL_POWER_FEEDBACK); + RemoveGravityLapse(); + GravityLapseTimer = 10000; + GravityLapsePhase = 0; + break; + } + } else GravityLapseTimer -= diff; + } + break; } - break; } - } -}; + }; -struct mob_felkael_flamestrikeAI : public ScriptedAI +}; +
class mob_felkael_flamestrike : public CreatureScript { - mob_felkael_flamestrikeAI(Creature *c) : ScriptedAI(c) +public: + mob_felkael_flamestrike() : CreatureScript("mob_felkael_flamestrike") { } + + CreatureAI* GetAI(Creature* c) { + return new mob_felkael_flamestrikeAI(c); } - uint32 FlameStrikeTimer; - - void Reset() + struct mob_felkael_flamestrikeAI : public ScriptedAI { - FlameStrikeTimer = 5000; + mob_felkael_flamestrikeAI(Creature *c) : ScriptedAI(c) + { + } - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->setFaction(14); + uint32 FlameStrikeTimer; - DoCast(me, SPELL_FLAMESTRIKE2, true); - } + void Reset() + { + FlameStrikeTimer = 5000; - void EnterCombat(Unit * /*who*/) {} - void MoveInLineOfSight(Unit * /*who*/) {} - void UpdateAI(const uint32 diff) - { - if (FlameStrikeTimer <= diff) + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->setFaction(14); + + DoCast(me, SPELL_FLAMESTRIKE2, true); + } + + void EnterCombat(Unit * /*who*/) {} + void MoveInLineOfSight(Unit * /*who*/) {} + void UpdateAI(const uint32 diff) { - DoCast(me, SPELL_FLAMESTRIKE1_NORMAL, true); - me->Kill(me); - } else FlameStrikeTimer -= diff; - } -}; + if (FlameStrikeTimer <= diff) + { + DoCast(me, SPELL_FLAMESTRIKE1_NORMAL, true); + me->Kill(me); + } else FlameStrikeTimer -= diff; + } + }; -struct mob_felkael_phoenixAI : public ScriptedAI +}; +
class mob_felkael_phoenix : public CreatureScript { - mob_felkael_phoenixAI(Creature* c) : ScriptedAI(c) - { - pInstance = c->GetInstanceData(); - } - - ScriptedInstance* pInstance; - uint32 BurnTimer; - uint32 Death_Timer; - bool Rebirth; - bool FakeDeath; +public: + mob_felkael_phoenix() : CreatureScript("mob_felkael_phoenix") { } - void Reset() + CreatureAI* GetAI(Creature* c) { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE + UNIT_FLAG_NON_ATTACKABLE); - me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); - DoCast(me, SPELL_PHOENIX_BURN, true); - BurnTimer = 2000; - Death_Timer = 3000; - Rebirth = false; - FakeDeath = false; + return new mob_felkael_phoenixAI(c); } - void EnterCombat(Unit* /*who*/) {} - - void DamageTaken(Unit* /*pKiller*/, uint32 &damage) + struct mob_felkael_phoenixAI : public ScriptedAI { - if (damage < me->GetHealth()) - return; - - //Prevent glitch if in fake death - if (FakeDeath) + mob_felkael_phoenixAI(Creature* c) : ScriptedAI(c) { - damage = 0; - return; + pInstance = c->GetInstanceScript(); + } + InstanceScript* pInstance; + uint32 BurnTimer; + uint32 Death_Timer; + bool Rebirth; + bool FakeDeath; + + void Reset() + { + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE + UNIT_FLAG_NON_ATTACKABLE); + me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + DoCast(me, SPELL_PHOENIX_BURN, true); + BurnTimer = 2000; + Death_Timer = 3000; + Rebirth = false; + FakeDeath = false; } - //Don't really die in all phases of Kael'Thas - if (pInstance && pInstance->GetData(DATA_KAELTHAS_EVENT) == 0) + + void EnterCombat(Unit* /*who*/) {} + + void DamageTaken(Unit* /*pKiller*/, uint32 &damage) { - //prevent death - damage = 0; - FakeDeath = true; - - me->InterruptNonMeleeSpells(false); - me->SetHealth(0); - me->StopMoving(); - me->ClearComboPointHolders(); - me->RemoveAllAurasOnDeath(); - me->ModifyAuraState(AURA_STATE_HEALTHLESS_20_PERCENT, false); - me->ModifyAuraState(AURA_STATE_HEALTHLESS_35_PERCENT, false); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->ClearAllReactives(); - me->SetUInt64Value(UNIT_FIELD_TARGET,0); - me->GetMotionMaster()->Clear(); - me->GetMotionMaster()->MoveIdle(); - me->SetStandState(UNIT_STAND_STATE_DEAD); + if (damage < me->GetHealth()) + return; - } + //Prevent glitch if in fake death + if (FakeDeath) + { + damage = 0; + return; - } + } + //Don't really die in all phases of Kael'Thas + if (pInstance && pInstance->GetData(DATA_KAELTHAS_EVENT) == 0) + { + //prevent death + damage = 0; + FakeDeath = true; + + me->InterruptNonMeleeSpells(false); + me->SetHealth(0); + me->StopMoving(); + me->ClearComboPointHolders(); + me->RemoveAllAurasOnDeath(); + me->ModifyAuraState(AURA_STATE_HEALTHLESS_20_PERCENT, false); + me->ModifyAuraState(AURA_STATE_HEALTHLESS_35_PERCENT, false); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->ClearAllReactives(); + me->SetUInt64Value(UNIT_FIELD_TARGET,0); + me->GetMotionMaster()->Clear(); + me->GetMotionMaster()->MoveIdle(); + me->SetStandState(UNIT_STAND_STATE_DEAD); + + } - void JustDied(Unit* /*slayer*/) - { - me->SummonCreature(CREATURE_PHOENIX_EGG, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 45000); - } + } - void UpdateAI(const uint32 diff) - { + void JustDied(Unit* /*slayer*/) + { + me->SummonCreature(CREATURE_PHOENIX_EGG, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 45000); + } - //If we are fake death, we cast revbirth and after that we kill the phoenix to spawn the egg. - if (FakeDeath) + void UpdateAI(const uint32 diff) { - if (!Rebirth) - { - DoCast(me, SPELL_REBIRTH_DMG); - Rebirth = true; - } - if (Rebirth) + //If we are fake death, we cast revbirth and after that we kill the phoenix to spawn the egg. + if (FakeDeath) { + if (!Rebirth) + { + DoCast(me, SPELL_REBIRTH_DMG); + Rebirth = true; + } - if (Death_Timer <= diff) + if (Rebirth) { - me->SummonCreature(CREATURE_PHOENIX_EGG, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 45000); - me->DisappearAndDie(); - Rebirth = false; - } else Death_Timer -= diff; + + if (Death_Timer <= diff) + { + me->SummonCreature(CREATURE_PHOENIX_EGG, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 45000); + me->DisappearAndDie(); + Rebirth = false; + } else Death_Timer -= diff; + } + } - } + if (!UpdateVictim()) + return; - if (!UpdateVictim()) - return; + if (BurnTimer <= diff) + { + //spell Burn should possible do this, but it doesn't, so do this for now. + uint16 dmg = urand(1650,2050); + me->DealDamage(me, dmg, 0, DOT, SPELL_SCHOOL_MASK_FIRE, NULL, false); + BurnTimer += 2000; + } BurnTimer -= diff; - if (BurnTimer <= diff) - { - //spell Burn should possible do this, but it doesn't, so do this for now. - uint16 dmg = urand(1650,2050); - me->DealDamage(me, dmg, 0, DOT, SPELL_SCHOOL_MASK_FIRE, NULL, false); - BurnTimer += 2000; - } BurnTimer -= diff; + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; - -struct mob_felkael_phoenix_eggAI : public ScriptedAI +
class mob_felkael_phoenix_egg : public CreatureScript { - mob_felkael_phoenix_eggAI(Creature *c) : ScriptedAI(c) {} +public: + mob_felkael_phoenix_egg() : CreatureScript("mob_felkael_phoenix_egg") { } - uint32 HatchTimer; - - void Reset() + CreatureAI* GetAI(Creature* c) { - HatchTimer = 10000; + return new mob_felkael_phoenix_eggAI(c); } - void EnterCombat(Unit* /*who*/) {} - void MoveInLineOfSight(Unit* /*who*/) {} - - void UpdateAI(const uint32 diff) + struct mob_felkael_phoenix_eggAI : public ScriptedAI { - if (HatchTimer <= diff) + mob_felkael_phoenix_eggAI(Creature *c) : ScriptedAI(c) {} + + uint32 HatchTimer; + + void Reset() { - me->SummonCreature(CREATURE_PHOENIX, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 60000); - me->Kill(me); - } else HatchTimer -= diff; + HatchTimer = 10000; + } - } -}; + void EnterCombat(Unit* /*who*/) {} + void MoveInLineOfSight(Unit* /*who*/) {} -struct mob_arcane_sphereAI : public ScriptedAI + void UpdateAI(const uint32 diff) + { + if (HatchTimer <= diff) + { + me->SummonCreature(CREATURE_PHOENIX, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 60000); + me->Kill(me); + } else HatchTimer -= diff; + + } + }; + +}; +
class mob_arcane_sphere : public CreatureScript { - mob_arcane_sphereAI(Creature *c) : ScriptedAI(c) { Reset(); } +public: + mob_arcane_sphere() : CreatureScript("mob_arcane_sphere") { } - uint32 DespawnTimer; - uint32 ChangeTargetTimer; + CreatureAI* GetAI(Creature* c) + { + return new mob_arcane_sphereAI(c); + } - void Reset() + struct mob_arcane_sphereAI : public ScriptedAI { - DespawnTimer = 30000; - ChangeTargetTimer = urand(6000,12000); + mob_arcane_sphereAI(Creature *c) : ScriptedAI(c) { Reset(); } - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); - me->setFaction(14); - DoCast(me, SPELL_ARCANE_SPHERE_PASSIVE, true); - } + uint32 DespawnTimer; + uint32 ChangeTargetTimer; - void EnterCombat(Unit* /*who*/) {} + void Reset() + { + DespawnTimer = 30000; + ChangeTargetTimer = urand(6000,12000); - void UpdateAI(const uint32 diff) - { - if (DespawnTimer <= diff) - me->Kill(me); - else - DespawnTimer -= diff; + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + me->setFaction(14); + DoCast(me, SPELL_ARCANE_SPHERE_PASSIVE, true); + } - //Return since we have no target - if (!UpdateVictim()) - return; + void EnterCombat(Unit* /*who*/) {} - if (ChangeTargetTimer <= diff) + void UpdateAI(const uint32 diff) { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + if (DespawnTimer <= diff) + me->Kill(me); + else + DespawnTimer -= diff; + + //Return since we have no target + if (!UpdateVictim()) + return; + + if (ChangeTargetTimer <= diff) { - me->AddThreat(pTarget, 1.0f); - me->TauntApply(pTarget); - AttackStart(pTarget); - } + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + { + me->AddThreat(pTarget, 1.0f); + me->TauntApply(pTarget); + AttackStart(pTarget); + } + + ChangeTargetTimer = urand(5000,15000); + } else ChangeTargetTimer -= diff; + } + }; - ChangeTargetTimer = urand(5000,15000); - } else ChangeTargetTimer -= diff; - } }; -CreatureAI* GetAI_boss_felblood_kaelthas(Creature* c) -{ - return new boss_felblood_kaelthasAI(c); -} -CreatureAI* GetAI_mob_arcane_sphere(Creature* c) -{ - return new mob_arcane_sphereAI(c); -} -CreatureAI* GetAI_mob_felkael_phoenix(Creature* c) -{ - return new mob_felkael_phoenixAI(c); -} -CreatureAI* GetAI_mob_felkael_phoenix_egg(Creature* c) -{ - return new mob_felkael_phoenix_eggAI(c); -} -CreatureAI* GetAI_mob_felkael_flamestrike(Creature* c) -{ - return new mob_felkael_flamestrikeAI(c); -} void AddSC_boss_felblood_kaelthas() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_felblood_kaelthas"; - newscript->GetAI = &GetAI_boss_felblood_kaelthas; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_arcane_sphere"; - newscript->GetAI = &GetAI_mob_arcane_sphere; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_felkael_phoenix"; - newscript->GetAI = &GetAI_mob_felkael_phoenix; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_felkael_phoenix_egg"; - newscript->GetAI = &GetAI_mob_felkael_phoenix_egg; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_felkael_flamestrike"; - newscript->GetAI = &GetAI_mob_felkael_flamestrike; - newscript->RegisterSelf(); + new boss_felblood_kaelthas(); + new mob_arcane_sphere(); + new mob_felkael_phoenix(); + new mob_felkael_phoenix_egg(); + new mob_felkael_flamestrike(); } - diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp index bc4049bb1fb..1c0eb29c70c 100644 --- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp +++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp @@ -86,247 +86,254 @@ const uint32 m_auiAddEntries[] = 24553, //Apoko 24556, //Zelfan }; - -struct boss_priestess_delrissaAI : public ScriptedAI +
class boss_priestess_delrissa : public CreatureScript { - boss_priestess_delrissaAI(Creature* c) : ScriptedAI(c) +public: + boss_priestess_delrissa() : CreatureScript("boss_priestess_delrissa") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); - memset(&m_auiLackeyGUID, 0, sizeof(m_auiLackeyGUID)); - LackeyEntryList.clear(); + return new boss_priestess_delrissaAI(pCreature); } - ScriptedInstance* pInstance; + struct boss_priestess_delrissaAI : public ScriptedAI + { + boss_priestess_delrissaAI(Creature* c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + memset(&m_auiLackeyGUID, 0, sizeof(m_auiLackeyGUID)); + LackeyEntryList.clear(); + } - std::vector<uint32> LackeyEntryList; - uint64 m_auiLackeyGUID[MAX_ACTIVE_LACKEY]; + InstanceScript* pInstance; - uint8 PlayersKilled; + std::vector<uint32> LackeyEntryList; + uint64 m_auiLackeyGUID[MAX_ACTIVE_LACKEY]; - uint32 HealTimer; - uint32 RenewTimer; - uint32 ShieldTimer; - uint32 SWPainTimer; - uint32 DispelTimer; - uint32 ResetTimer; + uint8 PlayersKilled; - void Reset() - { - PlayersKilled = 0; + uint32 HealTimer; + uint32 RenewTimer; + uint32 ShieldTimer; + uint32 SWPainTimer; + uint32 DispelTimer; + uint32 ResetTimer; - HealTimer = 15000; - RenewTimer = 10000; - ShieldTimer = 2000; - SWPainTimer = 5000; - DispelTimer = 7500; - ResetTimer = 5000; + void Reset() + { + PlayersKilled = 0; - InitializeLackeys(); - } + HealTimer = 15000; + RenewTimer = 10000; + ShieldTimer = 2000; + SWPainTimer = 5000; + DispelTimer = 7500; + ResetTimer = 5000; - //this mean she at some point evaded - void JustReachedHome() - { - if (pInstance) - pInstance->SetData(DATA_DELRISSA_EVENT, FAIL); - } + InitializeLackeys(); + } - void EnterCombat(Unit* who) - { - DoScriptText(SAY_AGGRO, me); + //this mean she at some point evaded + void JustReachedHome() + { + if (pInstance) + pInstance->SetData(DATA_DELRISSA_EVENT, FAIL); + } - for (uint8 i = 0; i < MAX_ACTIVE_LACKEY; ++i) + void EnterCombat(Unit* who) { - if (Unit* pAdd = Unit::GetUnit(*me, m_auiLackeyGUID[i])) + DoScriptText(SAY_AGGRO, me); + + for (uint8 i = 0; i < MAX_ACTIVE_LACKEY; ++i) { - if (!pAdd->getVictim()) + if (Unit* pAdd = Unit::GetUnit(*me, m_auiLackeyGUID[i])) { - who->SetInCombatWith(pAdd); - pAdd->AddThreat(who, 0.0f); + if (!pAdd->getVictim()) + { + who->SetInCombatWith(pAdd); + pAdd->AddThreat(who, 0.0f); + } } } - } - - if (pInstance) - pInstance->SetData(DATA_DELRISSA_EVENT, IN_PROGRESS); - } - void InitializeLackeys() - { - //can be called if Creature are dead, so avoid - if (!me->isAlive()) - return; - - uint8 j = 0; + if (pInstance) + pInstance->SetData(DATA_DELRISSA_EVENT, IN_PROGRESS); + } - //it's empty, so first time - if (LackeyEntryList.empty()) + void InitializeLackeys() { - //pre-allocate size for speed - LackeyEntryList.resize((sizeof(m_auiAddEntries) / sizeof(uint32))); - - //fill vector array with entries from Creature array - for (uint8 i = 0; i < LackeyEntryList.size(); ++i) - LackeyEntryList[i] = m_auiAddEntries[i]; + //can be called if Creature are dead, so avoid + if (!me->isAlive()) + return; - //remove random entries - while (LackeyEntryList.size() > MAX_ACTIVE_LACKEY) - LackeyEntryList.erase(LackeyEntryList.begin() + rand()%LackeyEntryList.size()); + uint8 j = 0; - //summon all the remaining in vector - for (std::vector<uint32>::const_iterator itr = LackeyEntryList.begin(); itr != LackeyEntryList.end(); ++itr) + //it's empty, so first time + if (LackeyEntryList.empty()) { - if (Creature* pAdd = me->SummonCreature((*itr), LackeyLocations[j][0], LackeyLocations[j][1], fZLocation, fOrientation, TEMPSUMMON_CORPSE_DESPAWN, 0)) - m_auiLackeyGUID[j] = pAdd->GetGUID(); + //pre-allocate size for speed + LackeyEntryList.resize((sizeof(m_auiAddEntries) / sizeof(uint32))); - ++j; - } - } - else - { - for (std::vector<uint32>::const_iterator itr = LackeyEntryList.begin(); itr != LackeyEntryList.end(); ++itr) - { - Unit* pAdd = Unit::GetUnit(*me, m_auiLackeyGUID[j]); + //fill vector array with entries from Creature array + for (uint8 i = 0; i < LackeyEntryList.size(); ++i) + LackeyEntryList[i] = m_auiAddEntries[i]; - //object already removed, not exist - if (!pAdd) + //remove random entries + while (LackeyEntryList.size() > MAX_ACTIVE_LACKEY) + LackeyEntryList.erase(LackeyEntryList.begin() + rand()%LackeyEntryList.size()); + + //summon all the remaining in vector + for (std::vector<uint32>::const_iterator itr = LackeyEntryList.begin(); itr != LackeyEntryList.end(); ++itr) { if (Creature* pAdd = me->SummonCreature((*itr), LackeyLocations[j][0], LackeyLocations[j][1], fZLocation, fOrientation, TEMPSUMMON_CORPSE_DESPAWN, 0)) m_auiLackeyGUID[j] = pAdd->GetGUID(); + + ++j; } - ++j; } - } - } - - void KilledUnit(Unit* victim) - { - if (victim->GetTypeId() != TYPEID_PLAYER) - return; + else + { + for (std::vector<uint32>::const_iterator itr = LackeyEntryList.begin(); itr != LackeyEntryList.end(); ++itr) + { + Unit* pAdd = Unit::GetUnit(*me, m_auiLackeyGUID[j]); - DoScriptText(PlayerDeath[PlayersKilled].id, me); + //object already removed, not exist + if (!pAdd) + { + if (Creature* pAdd = me->SummonCreature((*itr), LackeyLocations[j][0], LackeyLocations[j][1], fZLocation, fOrientation, TEMPSUMMON_CORPSE_DESPAWN, 0)) + m_auiLackeyGUID[j] = pAdd->GetGUID(); + } + ++j; + } + } + } - if (PlayersKilled < 4) - ++PlayersKilled; - } + void KilledUnit(Unit* victim) + { + if (victim->GetTypeId() != TYPEID_PLAYER) + return; - void JustDied(Unit* /*killer*/) - { - DoScriptText(SAY_DEATH, me); + DoScriptText(PlayerDeath[PlayersKilled].id, me); - if (!pInstance) - return; + if (PlayersKilled < 4) + ++PlayersKilled; + } - if (pInstance->GetData(DATA_DELRISSA_DEATH_COUNT) == MAX_ACTIVE_LACKEY) - pInstance->SetData(DATA_DELRISSA_EVENT, DONE); - else + void JustDied(Unit* /*killer*/) { - if (me->HasFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE)) - me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); - } - } + DoScriptText(SAY_DEATH, me); - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + if (!pInstance) + return; - if (ResetTimer <= diff) - { - float x, y, z, o; - me->GetHomePosition(x, y, z, o); - if (me->GetPositionZ() >= z+10) + if (pInstance->GetData(DATA_DELRISSA_DEATH_COUNT) == MAX_ACTIVE_LACKEY) + pInstance->SetData(DATA_DELRISSA_EVENT, DONE); + else { - EnterEvadeMode(); - return; + if (me->HasFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE)) + me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); } - ResetTimer = 5000; - } else ResetTimer -= diff; + } - if (HealTimer <= diff) + void UpdateAI(const uint32 diff) { - uint32 health = me->GetHealth(); - Unit *pTarget = me; - for (uint8 i = 0; i < MAX_ACTIVE_LACKEY; ++i) + if (!UpdateVictim()) + return; + + if (ResetTimer <= diff) { - if (Unit* pAdd = Unit::GetUnit(*me, m_auiLackeyGUID[i])) + float x, y, z, o; + me->GetHomePosition(x, y, z, o); + if (me->GetPositionZ() >= z+10) { - if (pAdd->isAlive() && pAdd->GetHealth() < health) - pTarget = pAdd; + EnterEvadeMode(); + return; } - } + ResetTimer = 5000; + } else ResetTimer -= diff; - DoCast(pTarget, SPELL_FLASH_HEAL); - HealTimer = 15000; - } else HealTimer -= diff; + if (HealTimer <= diff) + { + uint32 health = me->GetHealth(); + Unit *pTarget = me; + for (uint8 i = 0; i < MAX_ACTIVE_LACKEY; ++i) + { + if (Unit* pAdd = Unit::GetUnit(*me, m_auiLackeyGUID[i])) + { + if (pAdd->isAlive() && pAdd->GetHealth() < health) + pTarget = pAdd; + } + } - if (RenewTimer <= diff) - { - Unit *pTarget = me; + DoCast(pTarget, SPELL_FLASH_HEAL); + HealTimer = 15000; + } else HealTimer -= diff; - if (urand(0,1)) - if (Unit* pAdd = Unit::GetUnit(*me, m_auiLackeyGUID[rand()%MAX_ACTIVE_LACKEY])) - if (pAdd->isAlive()) - pTarget = pAdd; + if (RenewTimer <= diff) + { + Unit *pTarget = me; - DoCast(pTarget, SPELL_RENEW_NORMAL); - RenewTimer = 5000; - } else RenewTimer -= diff; + if (urand(0,1)) + if (Unit* pAdd = Unit::GetUnit(*me, m_auiLackeyGUID[rand()%MAX_ACTIVE_LACKEY])) + if (pAdd->isAlive()) + pTarget = pAdd; - if (ShieldTimer <= diff) - { - Unit *pTarget = me; + DoCast(pTarget, SPELL_RENEW_NORMAL); + RenewTimer = 5000; + } else RenewTimer -= diff; - if (urand(0,1)) - if (Unit* pAdd = Unit::GetUnit(*me, m_auiLackeyGUID[rand()%MAX_ACTIVE_LACKEY])) - if (pAdd->isAlive() && !pAdd->HasAura(SPELL_SHIELD)) - pTarget = pAdd; + if (ShieldTimer <= diff) + { + Unit *pTarget = me; - DoCast(pTarget, SPELL_SHIELD); - ShieldTimer = 7500; - } else ShieldTimer -= diff; + if (urand(0,1)) + if (Unit* pAdd = Unit::GetUnit(*me, m_auiLackeyGUID[rand()%MAX_ACTIVE_LACKEY])) + if (pAdd->isAlive() && !pAdd->HasAura(SPELL_SHIELD)) + pTarget = pAdd; - if (DispelTimer <= diff) - { - Unit *pTarget = NULL; - bool friendly = false; + DoCast(pTarget, SPELL_SHIELD); + ShieldTimer = 7500; + } else ShieldTimer -= diff; - if (urand(0,1)) - pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); - else + if (DispelTimer <= diff) { - friendly = true; + Unit *pTarget = NULL; + bool friendly = false; if (urand(0,1)) - pTarget = me; + pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); else - if (Unit* pAdd = Unit::GetUnit(*me, m_auiLackeyGUID[rand()%MAX_ACTIVE_LACKEY])) - if (pAdd->isAlive()) - pTarget = pAdd; - } + { + friendly = true; + + if (urand(0,1)) + pTarget = me; + else + if (Unit* pAdd = Unit::GetUnit(*me, m_auiLackeyGUID[rand()%MAX_ACTIVE_LACKEY])) + if (pAdd->isAlive()) + pTarget = pAdd; + } - if (pTarget) - DoCast(pTarget, SPELL_DISPEL_MAGIC); + if (pTarget) + DoCast(pTarget, SPELL_DISPEL_MAGIC); - DispelTimer = 12000; - } else DispelTimer -= diff; + DispelTimer = 12000; + } else DispelTimer -= diff; - if (SWPainTimer <= diff) - { - if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(pTarget, SPELL_SW_PAIN_NORMAL); + if (SWPainTimer <= diff) + { + if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + DoCast(pTarget, SPELL_SW_PAIN_NORMAL); - SWPainTimer = 10000; - } else SWPainTimer -= diff; + SWPainTimer = 10000; + } else SWPainTimer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_priestess_delrissa(Creature* pCreature) -{ - return new boss_priestess_delrissaAI(pCreature); -} enum eHealingPotion { @@ -338,12 +345,12 @@ struct boss_priestess_lackey_commonAI : public ScriptedAI { boss_priestess_lackey_commonAI(Creature* c) : ScriptedAI(c) { - pInstance = c->GetInstanceData(); + pInstance = c->GetInstanceScript(); memset(&m_auiLackeyGUIDs, 0, sizeof(m_auiLackeyGUIDs)); AcquireGUIDs(); } - ScriptedInstance* pInstance; + InstanceScript* pInstance; uint64 m_auiLackeyGUIDs[MAX_ACTIVE_LACKEY]; uint32 ResetThreatTimer; @@ -447,7 +454,7 @@ struct boss_priestess_lackey_commonAI : public ScriptedAI if (Creature* Delrissa = (Unit::GetCreature(*me, pInstance->GetData64(DATA_DELRISSA)))) { for (uint8 i = 0; i < MAX_ACTIVE_LACKEY; ++i) - m_auiLackeyGUIDs[i] = CAST_AI(boss_priestess_delrissaAI, Delrissa->AI())->m_auiLackeyGUID[i]; + m_auiLackeyGUIDs[i] = CAST_AI(boss_priestess_delrissa::boss_priestess_delrissaAI, Delrissa->AI())->m_auiLackeyGUID[i]; } } @@ -476,93 +483,100 @@ enum eRogueSpells SPELL_BACKSTAB = 15657, SPELL_EVISCERATE = 27611 }; - -struct boss_kagani_nightstrikeAI : public boss_priestess_lackey_commonAI +
class boss_kagani_nightstrike : public CreatureScript { - //Rogue - boss_kagani_nightstrikeAI(Creature *c) : boss_priestess_lackey_commonAI(c) {} +public: + boss_kagani_nightstrike() : CreatureScript("boss_kagani_nightstrike") { } - uint32 Gouge_Timer; - uint32 Kick_Timer; - uint32 Vanish_Timer; - uint32 Eviscerate_Timer; - uint32 Wait_Timer; - bool InVanish; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - Gouge_Timer = 5500; - Kick_Timer = 7000; - Vanish_Timer = 2000; - Eviscerate_Timer = 6000; - Wait_Timer = 5000; - InVanish = false; - me->SetVisibility(VISIBILITY_ON); - - boss_priestess_lackey_commonAI::Reset(); + return new boss_kagani_nightstrikeAI(pCreature); } - void UpdateAI(const uint32 diff) + struct boss_kagani_nightstrikeAI : public boss_priestess_lackey_commonAI { - if (!UpdateVictim()) - return; + //Rogue + boss_kagani_nightstrikeAI(Creature *c) : boss_priestess_lackey_commonAI(c) {} - boss_priestess_lackey_commonAI::UpdateAI(diff); + uint32 Gouge_Timer; + uint32 Kick_Timer; + uint32 Vanish_Timer; + uint32 Eviscerate_Timer; + uint32 Wait_Timer; + bool InVanish; - if (Vanish_Timer <= diff) + void Reset() { - DoCast(me, SPELL_VANISH); + Gouge_Timer = 5500; + Kick_Timer = 7000; + Vanish_Timer = 2000; + Eviscerate_Timer = 6000; + Wait_Timer = 5000; + InVanish = false; + me->SetVisibility(VISIBILITY_ON); - Unit* pUnit = SelectUnit(SELECT_TARGET_RANDOM, 0); + boss_priestess_lackey_commonAI::Reset(); + } - DoResetThreat(); + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; - if (pUnit) - me->AddThreat(pUnit, 1000.0f); + boss_priestess_lackey_commonAI::UpdateAI(diff); - InVanish = true; - Vanish_Timer = 30000; - Wait_Timer = 10000; - } else Vanish_Timer -= diff; + if (Vanish_Timer <= diff) + { + DoCast(me, SPELL_VANISH); - if (InVanish) - { - if (Wait_Timer <= diff) + Unit* pUnit = SelectUnit(SELECT_TARGET_RANDOM, 0); + + DoResetThreat(); + + if (pUnit) + me->AddThreat(pUnit, 1000.0f); + + InVanish = true; + Vanish_Timer = 30000; + Wait_Timer = 10000; + } else Vanish_Timer -= diff; + + if (InVanish) { - DoCast(me->getVictim(), SPELL_BACKSTAB, true); - DoCast(me->getVictim(), SPELL_KIDNEY_SHOT, true); - me->SetVisibility(VISIBILITY_ON); // ...? Hacklike - InVanish = false; - } else Wait_Timer -= diff; - } + if (Wait_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_BACKSTAB, true); + DoCast(me->getVictim(), SPELL_KIDNEY_SHOT, true); + me->SetVisibility(VISIBILITY_ON); // ...? Hacklike + InVanish = false; + } else Wait_Timer -= diff; + } - if (Gouge_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_GOUGE); - Gouge_Timer = 5500; - } else Gouge_Timer -= diff; + if (Gouge_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_GOUGE); + Gouge_Timer = 5500; + } else Gouge_Timer -= diff; - if (Kick_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_KICK); - Kick_Timer = 7000; - } else Kick_Timer -= diff; + if (Kick_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_KICK); + Kick_Timer = 7000; + } else Kick_Timer -= diff; - if (Eviscerate_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_EVISCERATE); - Eviscerate_Timer = 4000; - } else Eviscerate_Timer -= diff; + if (Eviscerate_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_EVISCERATE); + Eviscerate_Timer = 4000; + } else Eviscerate_Timer -= diff; + + if (!InVanish) + DoMeleeAttackIfReady(); + } + }; - if (!InVanish) - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_kagani_nightstrike(Creature* pCreature) -{ - return new boss_kagani_nightstrikeAI(pCreature); -} enum eWarlockSpells { @@ -574,135 +588,147 @@ enum eWarlockSpells SPELL_IMP_FIREBALL = 44164, SPELL_SUMMON_IMP = 44163 }; - -struct boss_ellris_duskhallowAI : public boss_priestess_lackey_commonAI +
class boss_ellris_duskhallow : public CreatureScript { - //Warlock - boss_ellris_duskhallowAI(Creature *c) : boss_priestess_lackey_commonAI(c) {} - - uint32 Immolate_Timer; - uint32 Shadow_Bolt_Timer; - uint32 Seed_of_Corruption_Timer; - uint32 Curse_of_Agony_Timer; - uint32 Fear_Timer; - - void Reset() - { - Immolate_Timer = 6000; - Shadow_Bolt_Timer = 3000; - Seed_of_Corruption_Timer = 2000; - Curse_of_Agony_Timer = 1000; - Fear_Timer = 10000; - - boss_priestess_lackey_commonAI::Reset(); - } +public: + boss_ellris_duskhallow() : CreatureScript("boss_ellris_duskhallow") { } - void EnterCombat(Unit* /*pWho*/) + CreatureAI* GetAI(Creature* pCreature) const { - DoCast(me, SPELL_SUMMON_IMP); + return new boss_ellris_duskhallowAI(pCreature); } - void UpdateAI(const uint32 diff) + struct boss_ellris_duskhallowAI : public boss_priestess_lackey_commonAI { - if (!UpdateVictim()) - return; + //Warlock + boss_ellris_duskhallowAI(Creature *c) : boss_priestess_lackey_commonAI(c) {} - boss_priestess_lackey_commonAI::UpdateAI(diff); + uint32 Immolate_Timer; + uint32 Shadow_Bolt_Timer; + uint32 Seed_of_Corruption_Timer; + uint32 Curse_of_Agony_Timer; + uint32 Fear_Timer; - if (Immolate_Timer <= diff) + void Reset() { - DoCast(me->getVictim(), SPELL_IMMOLATE); Immolate_Timer = 6000; - } else Immolate_Timer -= diff; + Shadow_Bolt_Timer = 3000; + Seed_of_Corruption_Timer = 2000; + Curse_of_Agony_Timer = 1000; + Fear_Timer = 10000; - if (Shadow_Bolt_Timer <= diff) + boss_priestess_lackey_commonAI::Reset(); + } + + void EnterCombat(Unit* /*pWho*/) { - DoCast(me->getVictim(), SPELL_SHADOW_BOLT); - Shadow_Bolt_Timer = 5000; - } else Shadow_Bolt_Timer -= diff; + DoCast(me, SPELL_SUMMON_IMP); + } - if (Seed_of_Corruption_Timer <= diff) + void UpdateAI(const uint32 diff) { - if (Unit* pUnit = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pUnit, SPELL_SEED_OF_CORRUPTION); + if (!UpdateVictim()) + return; - Seed_of_Corruption_Timer = 10000; - } else Seed_of_Corruption_Timer -= diff; + boss_priestess_lackey_commonAI::UpdateAI(diff); - if (Curse_of_Agony_Timer <= diff) - { - if (Unit* pUnit = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pUnit, SPELL_CURSE_OF_AGONY); + if (Immolate_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_IMMOLATE); + Immolate_Timer = 6000; + } else Immolate_Timer -= diff; - Curse_of_Agony_Timer = 13000; - } else Curse_of_Agony_Timer -= diff; + if (Shadow_Bolt_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_SHADOW_BOLT); + Shadow_Bolt_Timer = 5000; + } else Shadow_Bolt_Timer -= diff; - if (Fear_Timer <= diff) - { - if (Unit* pUnit = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pUnit, SPELL_FEAR); + if (Seed_of_Corruption_Timer <= diff) + { + if (Unit* pUnit = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pUnit, SPELL_SEED_OF_CORRUPTION); - Fear_Timer = 10000; - } else Fear_Timer -= diff; + Seed_of_Corruption_Timer = 10000; + } else Seed_of_Corruption_Timer -= diff; - DoMeleeAttackIfReady(); - } -}; + if (Curse_of_Agony_Timer <= diff) + { + if (Unit* pUnit = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pUnit, SPELL_CURSE_OF_AGONY); -CreatureAI* GetAI_ellris_duskhallow(Creature* pCreature) -{ - return new boss_ellris_duskhallowAI(pCreature); -} + Curse_of_Agony_Timer = 13000; + } else Curse_of_Agony_Timer -= diff; + + if (Fear_Timer <= diff) + { + if (Unit* pUnit = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pUnit, SPELL_FEAR); + + Fear_Timer = 10000; + } else Fear_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; + +}; enum eKickDown { SPELL_KNOCKDOWN = 11428, SPELL_SNAP_KICK = 46182 }; - -struct boss_eramas_brightblazeAI : public boss_priestess_lackey_commonAI +
class boss_eramas_brightblaze : public CreatureScript { - //Monk - boss_eramas_brightblazeAI(Creature *c) : boss_priestess_lackey_commonAI(c) {} - - uint32 Knockdown_Timer; - uint32 Snap_Kick_Timer; +public: + boss_eramas_brightblaze() : CreatureScript("boss_eramas_brightblaze") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - Knockdown_Timer = 6000; - Snap_Kick_Timer = 4500; - - boss_priestess_lackey_commonAI::Reset(); + return new boss_eramas_brightblazeAI(pCreature); } - void UpdateAI(const uint32 diff) + struct boss_eramas_brightblazeAI : public boss_priestess_lackey_commonAI { - if (!UpdateVictim()) - return; + //Monk + boss_eramas_brightblazeAI(Creature *c) : boss_priestess_lackey_commonAI(c) {} - boss_priestess_lackey_commonAI::UpdateAI(diff); + uint32 Knockdown_Timer; + uint32 Snap_Kick_Timer; - if (Knockdown_Timer <= diff) + void Reset() { - DoCast(me->getVictim(), SPELL_KNOCKDOWN); Knockdown_Timer = 6000; - } else Knockdown_Timer -= diff; + Snap_Kick_Timer = 4500; + + boss_priestess_lackey_commonAI::Reset(); + } - if (Snap_Kick_Timer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_SNAP_KICK); - Snap_Kick_Timer = 4500; - } else Snap_Kick_Timer -= diff; + if (!UpdateVictim()) + return; - DoMeleeAttackIfReady(); - } -}; + boss_priestess_lackey_commonAI::UpdateAI(diff); -CreatureAI* GetAI_eramas_brightblaze(Creature* pCreature) -{ - return new boss_eramas_brightblazeAI(pCreature); -} + if (Knockdown_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_KNOCKDOWN); + Knockdown_Timer = 6000; + } else Knockdown_Timer -= diff; + + if (Snap_Kick_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_SNAP_KICK); + Snap_Kick_Timer = 4500; + } else Snap_Kick_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; + +}; enum eMageSpells { @@ -714,119 +740,125 @@ enum eMageSpells SPELL_FROSTBOLT = 15043, SPELL_BLINK = 14514 }; - -struct boss_yazzaiAI : public boss_priestess_lackey_commonAI +
class boss_yazzai : public CreatureScript { - //Mage - boss_yazzaiAI(Creature *c) : boss_priestess_lackey_commonAI(c) {} - - bool HasIceBlocked; - - uint32 Polymorph_Timer; - uint32 Ice_Block_Timer; - uint32 Wait_Timer; - uint32 Blizzard_Timer; - uint32 Ice_Lance_Timer; - uint32 Cone_of_Cold_Timer; - uint32 Frostbolt_Timer; - uint32 Blink_Timer; +public: + boss_yazzai() : CreatureScript("boss_yazzai") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - HasIceBlocked = false; - - Polymorph_Timer = 1000; - Ice_Block_Timer = 20000; - Wait_Timer = 10000; - Blizzard_Timer = 8000; - Ice_Lance_Timer = 12000; - Cone_of_Cold_Timer = 10000; - Frostbolt_Timer = 3000; - Blink_Timer = 8000; - - boss_priestess_lackey_commonAI::Reset(); + return new boss_yazzaiAI(pCreature); } - void UpdateAI(const uint32 diff) + struct boss_yazzaiAI : public boss_priestess_lackey_commonAI { - if (!UpdateVictim()) - return; + //Mage + boss_yazzaiAI(Creature *c) : boss_priestess_lackey_commonAI(c) {} - boss_priestess_lackey_commonAI::UpdateAI(diff); + bool HasIceBlocked; - if (Polymorph_Timer <= diff) - { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - { - DoCast(pTarget, SPELL_POLYMORPH); - Polymorph_Timer = 20000; - } - } else Polymorph_Timer -= diff; + uint32 Polymorph_Timer; + uint32 Ice_Block_Timer; + uint32 Wait_Timer; + uint32 Blizzard_Timer; + uint32 Ice_Lance_Timer; + uint32 Cone_of_Cold_Timer; + uint32 Frostbolt_Timer; + uint32 Blink_Timer; - if (((me->GetHealth()*100 / me->GetMaxHealth()) < 35) && !HasIceBlocked) + void Reset() { - DoCast(me, SPELL_ICE_BLOCK); - HasIceBlocked = true; + HasIceBlocked = false; + + Polymorph_Timer = 1000; + Ice_Block_Timer = 20000; + Wait_Timer = 10000; + Blizzard_Timer = 8000; + Ice_Lance_Timer = 12000; + Cone_of_Cold_Timer = 10000; + Frostbolt_Timer = 3000; + Blink_Timer = 8000; + + boss_priestess_lackey_commonAI::Reset(); } - if (Blizzard_Timer <= diff) + void UpdateAI(const uint32 diff) { - if (Unit* pUnit = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pUnit, SPELL_BLIZZARD); + if (!UpdateVictim()) + return; - Blizzard_Timer = 8000; - } else Blizzard_Timer -= diff; + boss_priestess_lackey_commonAI::UpdateAI(diff); - if (Ice_Lance_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_ICE_LANCE); - Ice_Lance_Timer = 12000; - } else Ice_Lance_Timer -= diff; + if (Polymorph_Timer <= diff) + { + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + { + DoCast(pTarget, SPELL_POLYMORPH); + Polymorph_Timer = 20000; + } + } else Polymorph_Timer -= diff; - if (Cone_of_Cold_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_CONE_OF_COLD); - Cone_of_Cold_Timer = 10000; - } else Cone_of_Cold_Timer -= diff; + if (((me->GetHealth()*100 / me->GetMaxHealth()) < 35) && !HasIceBlocked) + { + DoCast(me, SPELL_ICE_BLOCK); + HasIceBlocked = true; + } - if (Frostbolt_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_FROSTBOLT); - Frostbolt_Timer = 8000; - } else Frostbolt_Timer -= diff; + if (Blizzard_Timer <= diff) + { + if (Unit* pUnit = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pUnit, SPELL_BLIZZARD); - if (Blink_Timer <= diff) - { - bool InMeleeRange = false; - std::list<HostileReference*>& t_list = me->getThreatManager().getThreatList(); - for (std::list<HostileReference*>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) + Blizzard_Timer = 8000; + } else Blizzard_Timer -= diff; + + if (Ice_Lance_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_ICE_LANCE); + Ice_Lance_Timer = 12000; + } else Ice_Lance_Timer -= diff; + + if (Cone_of_Cold_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_CONE_OF_COLD); + Cone_of_Cold_Timer = 10000; + } else Cone_of_Cold_Timer -= diff; + + if (Frostbolt_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_FROSTBOLT); + Frostbolt_Timer = 8000; + } else Frostbolt_Timer -= diff; + + if (Blink_Timer <= diff) { - if (Unit *pTarget = Unit::GetUnit(*me, (*itr)->getUnitGuid())) + bool InMeleeRange = false; + std::list<HostileReference*>& t_list = me->getThreatManager().getThreatList(); + for (std::list<HostileReference*>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) { - //if in melee range - if (pTarget->IsWithinDistInMap(me, 5)) + if (Unit *pTarget = Unit::GetUnit(*me, (*itr)->getUnitGuid())) { - InMeleeRange = true; - break; + //if in melee range + if (pTarget->IsWithinDistInMap(me, 5)) + { + InMeleeRange = true; + break; + } } } - } - //if anybody is in melee range than escape by blink - if (InMeleeRange) - DoCast(me, SPELL_BLINK); + //if anybody is in melee range than escape by blink + if (InMeleeRange) + DoCast(me, SPELL_BLINK); - Blink_Timer = 8000; - } else Blink_Timer -= diff; + Blink_Timer = 8000; + } else Blink_Timer -= diff; - DoMeleeAttackIfReady(); - } -}; + DoMeleeAttackIfReady(); + } + }; -CreatureAI* GetAI_yazzai(Creature* pCreature) -{ - return new boss_yazzaiAI(pCreature); -} +}; enum eWarriorSpells { @@ -838,108 +870,114 @@ enum eWarriorSpells SPELL_BATTLE_SHOUT = 27578, SPELL_MORTAL_STRIKE = 44268 }; - -struct boss_warlord_salarisAI : public boss_priestess_lackey_commonAI +
class boss_warlord_salaris : public CreatureScript { - //Warrior - boss_warlord_salarisAI(Creature *c) : boss_priestess_lackey_commonAI(c) {} - - uint32 Intercept_Stun_Timer; - uint32 Disarm_Timer; - uint32 Piercing_Howl_Timer; - uint32 Frightening_Shout_Timer; - uint32 Hamstring_Timer; - uint32 Mortal_Strike_Timer; +public: + boss_warlord_salaris() : CreatureScript("boss_warlord_salaris") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - Intercept_Stun_Timer = 500; - Disarm_Timer = 6000; - Piercing_Howl_Timer = 10000; - Frightening_Shout_Timer = 18000; - Hamstring_Timer = 4500; - Mortal_Strike_Timer = 8000; - - boss_priestess_lackey_commonAI::Reset(); + return new boss_warlord_salarisAI(pCreature); } - void EnterCombat(Unit* /*who*/) + struct boss_warlord_salarisAI : public boss_priestess_lackey_commonAI { - DoCast(me, SPELL_BATTLE_SHOUT); - } + //Warrior + boss_warlord_salarisAI(Creature *c) : boss_priestess_lackey_commonAI(c) {} - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + uint32 Intercept_Stun_Timer; + uint32 Disarm_Timer; + uint32 Piercing_Howl_Timer; + uint32 Frightening_Shout_Timer; + uint32 Hamstring_Timer; + uint32 Mortal_Strike_Timer; - boss_priestess_lackey_commonAI::UpdateAI(diff); + void Reset() + { + Intercept_Stun_Timer = 500; + Disarm_Timer = 6000; + Piercing_Howl_Timer = 10000; + Frightening_Shout_Timer = 18000; + Hamstring_Timer = 4500; + Mortal_Strike_Timer = 8000; + + boss_priestess_lackey_commonAI::Reset(); + } - if (Intercept_Stun_Timer <= diff) + void EnterCombat(Unit* /*who*/) { - bool InMeleeRange = false; - std::list<HostileReference*>& t_list = me->getThreatManager().getThreatList(); - for (std::list<HostileReference*>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) + DoCast(me, SPELL_BATTLE_SHOUT); + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + boss_priestess_lackey_commonAI::UpdateAI(diff); + + if (Intercept_Stun_Timer <= diff) { - if (Unit *pTarget = Unit::GetUnit(*me, (*itr)->getUnitGuid())) + bool InMeleeRange = false; + std::list<HostileReference*>& t_list = me->getThreatManager().getThreatList(); + for (std::list<HostileReference*>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) { - //if in melee range - if (pTarget->IsWithinDistInMap(me, ATTACK_DISTANCE)) + if (Unit *pTarget = Unit::GetUnit(*me, (*itr)->getUnitGuid())) { - InMeleeRange = true; - break; + //if in melee range + if (pTarget->IsWithinDistInMap(me, ATTACK_DISTANCE)) + { + InMeleeRange = true; + break; + } } } - } - //if nobody is in melee range than try to use Intercept - if (!InMeleeRange) - { - if (Unit* pUnit = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pUnit, SPELL_INTERCEPT_STUN); - } + //if nobody is in melee range than try to use Intercept + if (!InMeleeRange) + { + if (Unit* pUnit = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pUnit, SPELL_INTERCEPT_STUN); + } - Intercept_Stun_Timer = 10000; - } else Intercept_Stun_Timer -= diff; + Intercept_Stun_Timer = 10000; + } else Intercept_Stun_Timer -= diff; - if (Disarm_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_DISARM); - Disarm_Timer = 6000; - } else Disarm_Timer -= diff; + if (Disarm_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_DISARM); + Disarm_Timer = 6000; + } else Disarm_Timer -= diff; - if (Hamstring_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_HAMSTRING); - Hamstring_Timer = 4500; - } else Hamstring_Timer -= diff; + if (Hamstring_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_HAMSTRING); + Hamstring_Timer = 4500; + } else Hamstring_Timer -= diff; - if (Mortal_Strike_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_MORTAL_STRIKE); - Mortal_Strike_Timer = 4500; - } else Mortal_Strike_Timer -= diff; + if (Mortal_Strike_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_MORTAL_STRIKE); + Mortal_Strike_Timer = 4500; + } else Mortal_Strike_Timer -= diff; - if (Piercing_Howl_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_PIERCING_HOWL); - Piercing_Howl_Timer = 10000; - } else Piercing_Howl_Timer -= diff; + if (Piercing_Howl_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_PIERCING_HOWL); + Piercing_Howl_Timer = 10000; + } else Piercing_Howl_Timer -= diff; - if (Frightening_Shout_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_FRIGHTENING_SHOUT); - Frightening_Shout_Timer = 18000; - } else Frightening_Shout_Timer -= diff; + if (Frightening_Shout_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_FRIGHTENING_SHOUT); + Frightening_Shout_Timer = 18000; + } else Frightening_Shout_Timer -= diff; - DoMeleeAttackIfReady(); - } -}; + DoMeleeAttackIfReady(); + } + }; -CreatureAI* GetAI_warlord_salaris(Creature* pCreature) -{ - return new boss_warlord_salarisAI(pCreature); -} +}; enum eHunterSpells { @@ -952,108 +990,114 @@ enum eHunterSpells NPC_SLIVER = 24552 }; - -struct boss_garaxxasAI : public boss_priestess_lackey_commonAI +
class boss_garaxxas : public CreatureScript { - //Hunter - boss_garaxxasAI(Creature *c) : boss_priestess_lackey_commonAI(c) { m_uiPetGUID = 0; } - - uint64 m_uiPetGUID; - - uint32 Aimed_Shot_Timer; - uint32 Shoot_Timer; - uint32 Concussive_Shot_Timer; - uint32 Multi_Shot_Timer; - uint32 Wing_Clip_Timer; - uint32 Freezing_Trap_Timer; +public: + boss_garaxxas() : CreatureScript("boss_garaxxas") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - Aimed_Shot_Timer = 6000; - Shoot_Timer = 2500; - Concussive_Shot_Timer = 8000; - Multi_Shot_Timer = 10000; - Wing_Clip_Timer = 4000; - Freezing_Trap_Timer = 15000; - - Unit* pPet = Unit::GetUnit(*me,m_uiPetGUID); - if (!pPet) - me->SummonCreature(NPC_SLIVER, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_CORPSE_DESPAWN, 0); - - boss_priestess_lackey_commonAI::Reset(); + return new boss_garaxxasAI(pCreature); } - void JustSummoned(Creature* pSummoned) + struct boss_garaxxasAI : public boss_priestess_lackey_commonAI { - m_uiPetGUID = pSummoned->GetGUID(); - } + //Hunter + boss_garaxxasAI(Creature *c) : boss_priestess_lackey_commonAI(c) { m_uiPetGUID = 0; } - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + uint64 m_uiPetGUID; - boss_priestess_lackey_commonAI::UpdateAI(diff); + uint32 Aimed_Shot_Timer; + uint32 Shoot_Timer; + uint32 Concussive_Shot_Timer; + uint32 Multi_Shot_Timer; + uint32 Wing_Clip_Timer; + uint32 Freezing_Trap_Timer; - if (me->IsWithinDistInMap(me->getVictim(), ATTACK_DISTANCE)) + void Reset() { - if (Wing_Clip_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_WING_CLIP); - Wing_Clip_Timer = 4000; - } else Wing_Clip_Timer -= diff; + Aimed_Shot_Timer = 6000; + Shoot_Timer = 2500; + Concussive_Shot_Timer = 8000; + Multi_Shot_Timer = 10000; + Wing_Clip_Timer = 4000; + Freezing_Trap_Timer = 15000; + + Unit* pPet = Unit::GetUnit(*me,m_uiPetGUID); + if (!pPet) + me->SummonCreature(NPC_SLIVER, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_CORPSE_DESPAWN, 0); + + boss_priestess_lackey_commonAI::Reset(); + } + + void JustSummoned(Creature* pSummoned) + { + m_uiPetGUID = pSummoned->GetGUID(); + } - if (Freezing_Trap_Timer <= diff) + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + boss_priestess_lackey_commonAI::UpdateAI(diff); + + if (me->IsWithinDistInMap(me->getVictim(), ATTACK_DISTANCE)) { - //attempt find go summoned from spell (casted by me) - GameObject* pGo = me->GetGameObject(SPELL_FREEZING_TRAP); + if (Wing_Clip_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_WING_CLIP); + Wing_Clip_Timer = 4000; + } else Wing_Clip_Timer -= diff; - //if we have a pGo, we need to wait (only one trap at a time) - if (pGo) - Freezing_Trap_Timer = 2500; - else + if (Freezing_Trap_Timer <= diff) { - //if pGo does not exist, then we can cast - DoCast(me->getVictim(), SPELL_FREEZING_TRAP); - Freezing_Trap_Timer = 15000; - } - } else Freezing_Trap_Timer -= diff; + //attempt find go summoned from spell (casted by me) + GameObject* pGo = me->GetGameObject(SPELL_FREEZING_TRAP); - DoMeleeAttackIfReady(); - } - else - { - if (Concussive_Shot_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_CONCUSSIVE_SHOT); - Concussive_Shot_Timer = 8000; - } else Concussive_Shot_Timer -= diff; + //if we have a pGo, we need to wait (only one trap at a time) + if (pGo) + Freezing_Trap_Timer = 2500; + else + { + //if pGo does not exist, then we can cast + DoCast(me->getVictim(), SPELL_FREEZING_TRAP); + Freezing_Trap_Timer = 15000; + } + } else Freezing_Trap_Timer -= diff; - if (Multi_Shot_Timer <= diff) + DoMeleeAttackIfReady(); + } + else { - DoCast(me->getVictim(), SPELL_MULTI_SHOT); - Multi_Shot_Timer = 10000; - } else Multi_Shot_Timer -= diff; + if (Concussive_Shot_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_CONCUSSIVE_SHOT); + Concussive_Shot_Timer = 8000; + } else Concussive_Shot_Timer -= diff; - if (Aimed_Shot_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_AIMED_SHOT); - Aimed_Shot_Timer = 6000; - } else Aimed_Shot_Timer -= diff; + if (Multi_Shot_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_MULTI_SHOT); + Multi_Shot_Timer = 10000; + } else Multi_Shot_Timer -= diff; - if (Shoot_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_SHOOT); - Shoot_Timer = 2500; - } else Shoot_Timer -= diff; + if (Aimed_Shot_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_AIMED_SHOT); + Aimed_Shot_Timer = 6000; + } else Aimed_Shot_Timer -= diff; + + if (Shoot_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_SHOOT); + Shoot_Timer = 2500; + } else Shoot_Timer -= diff; + } } - } -}; + }; -CreatureAI* GetAI_garaxxas(Creature* pCreature) -{ - return new boss_garaxxasAI(pCreature); -} +}; enum Spells { @@ -1065,88 +1109,94 @@ enum Spells SPELL_FIRE_NOVA_TOTEM = 44257, SPELL_EARTHBIND_TOTEM = 15786 }; - -struct boss_apokoAI : public boss_priestess_lackey_commonAI +
class boss_apoko : public CreatureScript { - //Shaman - boss_apokoAI(Creature *c) : boss_priestess_lackey_commonAI(c) {} - - uint32 Totem_Timer; - uint8 Totem_Amount; - uint32 War_Stomp_Timer; - uint32 Purge_Timer; - uint32 Healing_Wave_Timer; - uint32 Frost_Shock_Timer; +public: + boss_apoko() : CreatureScript("boss_apoko") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - Totem_Timer = 2000; - Totem_Amount = 1; - War_Stomp_Timer = 10000; - Purge_Timer = 8000; - Healing_Wave_Timer = 5000; - Frost_Shock_Timer = 7000; - - boss_priestess_lackey_commonAI::Reset(); + return new boss_apokoAI(pCreature); } - void UpdateAI(const uint32 diff) + struct boss_apokoAI : public boss_priestess_lackey_commonAI { - if (!UpdateVictim()) - return; - - boss_priestess_lackey_commonAI::UpdateAI(diff); + //Shaman + boss_apokoAI(Creature *c) : boss_priestess_lackey_commonAI(c) {} - if (Totem_Timer <= diff) - { - DoCast(me, RAND(SPELL_WINDFURY_TOTEM,SPELL_FIRE_NOVA_TOTEM,SPELL_EARTHBIND_TOTEM)); - ++Totem_Amount; - Totem_Timer = Totem_Amount*2000; - } else Totem_Timer -= diff; + uint32 Totem_Timer; + uint8 Totem_Amount; + uint32 War_Stomp_Timer; + uint32 Purge_Timer; + uint32 Healing_Wave_Timer; + uint32 Frost_Shock_Timer; - if (War_Stomp_Timer <= diff) + void Reset() { - DoCast(me, SPELL_WAR_STOMP); + Totem_Timer = 2000; + Totem_Amount = 1; War_Stomp_Timer = 10000; - } else War_Stomp_Timer -= diff; + Purge_Timer = 8000; + Healing_Wave_Timer = 5000; + Frost_Shock_Timer = 7000; - if (Purge_Timer <= diff) + boss_priestess_lackey_commonAI::Reset(); + } + + void UpdateAI(const uint32 diff) { - if (Unit* pUnit = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pUnit, SPELL_PURGE); + if (!UpdateVictim()) + return; - Purge_Timer = 15000; - } else Purge_Timer -= diff; + boss_priestess_lackey_commonAI::UpdateAI(diff); - if (Frost_Shock_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_FROST_SHOCK); - Frost_Shock_Timer = 7000; - } else Frost_Shock_Timer -= diff; + if (Totem_Timer <= diff) + { + DoCast(me, RAND(SPELL_WINDFURY_TOTEM,SPELL_FIRE_NOVA_TOTEM,SPELL_EARTHBIND_TOTEM)); + ++Totem_Amount; + Totem_Timer = Totem_Amount*2000; + } else Totem_Timer -= diff; - if (Healing_Wave_Timer <= diff) - { - // std::vector<Add*>::const_iterator itr = Group.begin() + rand()%Group.size(); - // uint64 guid = (*itr)->guid; - // if (guid) - // { - // Unit* pAdd = Unit::GetUnit(*me, (*itr)->guid); - // if (pAdd && pAdd->isAlive()) - // { - DoCast(me, SPELL_LESSER_HEALING_WAVE); - Healing_Wave_Timer = 5000; - // } - // } - } else Healing_Wave_Timer -= diff; + if (War_Stomp_Timer <= diff) + { + DoCast(me, SPELL_WAR_STOMP); + War_Stomp_Timer = 10000; + } else War_Stomp_Timer -= diff; - DoMeleeAttackIfReady(); - } -}; + if (Purge_Timer <= diff) + { + if (Unit* pUnit = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pUnit, SPELL_PURGE); -CreatureAI* GetAI_apoko(Creature* pCreature) -{ - return new boss_apokoAI(pCreature); -} + Purge_Timer = 15000; + } else Purge_Timer -= diff; + + if (Frost_Shock_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_FROST_SHOCK); + Frost_Shock_Timer = 7000; + } else Frost_Shock_Timer -= diff; + + if (Healing_Wave_Timer <= diff) + { + // std::vector<Add*>::const_iterator itr = Group.begin() + rand()%Group.size(); + // uint64 guid = (*itr)->guid; + // if (guid) + // { + // Unit* pAdd = Unit::GetUnit(*me, (*itr)->guid); + // if (pAdd && pAdd->isAlive()) + // { + DoCast(me, SPELL_LESSER_HEALING_WAVE); + Healing_Wave_Timer = 5000; + // } + // } + } else Healing_Wave_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; + +}; enum eEngineerSpells { @@ -1157,167 +1207,112 @@ enum eEngineerSpells SPELL_FEL_IRON_BOMB = 46024, SPELL_SHEEP_EXPLOSION = 44279 }; - -struct boss_zelfanAI : public boss_priestess_lackey_commonAI +
class boss_zelfan : public CreatureScript { - //Engineer - boss_zelfanAI(Creature *c) : boss_priestess_lackey_commonAI(c) {} +public: + boss_zelfan() : CreatureScript("boss_zelfan") { } - uint32 Goblin_Dragon_Gun_Timer; - uint32 Rocket_Launch_Timer; - uint32 Recombobulate_Timer; - uint32 High_Explosive_Sheep_Timer; - uint32 Fel_Iron_Bomb_Timer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - Goblin_Dragon_Gun_Timer = 20000; - Rocket_Launch_Timer = 7000; - Recombobulate_Timer = 4000; - High_Explosive_Sheep_Timer = 10000; - Fel_Iron_Bomb_Timer = 15000; - - boss_priestess_lackey_commonAI::Reset(); + return new boss_zelfanAI(pCreature); } - void UpdateAI(const uint32 diff) + struct boss_zelfanAI : public boss_priestess_lackey_commonAI { - if (!UpdateVictim()) - return; + //Engineer + boss_zelfanAI(Creature *c) : boss_priestess_lackey_commonAI(c) {} - boss_priestess_lackey_commonAI::UpdateAI(diff); + uint32 Goblin_Dragon_Gun_Timer; + uint32 Rocket_Launch_Timer; + uint32 Recombobulate_Timer; + uint32 High_Explosive_Sheep_Timer; + uint32 Fel_Iron_Bomb_Timer; - if (Goblin_Dragon_Gun_Timer <= diff) + void Reset() { - DoCast(me->getVictim(), SPELL_GOBLIN_DRAGON_GUN); - Goblin_Dragon_Gun_Timer = 10000; - } else Goblin_Dragon_Gun_Timer -= diff; + Goblin_Dragon_Gun_Timer = 20000; + Rocket_Launch_Timer = 7000; + Recombobulate_Timer = 4000; + High_Explosive_Sheep_Timer = 10000; + Fel_Iron_Bomb_Timer = 15000; - if (Rocket_Launch_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_ROCKET_LAUNCH); - Rocket_Launch_Timer = 9000; - } else Rocket_Launch_Timer -= diff; + boss_priestess_lackey_commonAI::Reset(); + } - if (Fel_Iron_Bomb_Timer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_FEL_IRON_BOMB); - Fel_Iron_Bomb_Timer = 15000; - } else Fel_Iron_Bomb_Timer -= diff; + if (!UpdateVictim()) + return; - if (Recombobulate_Timer <= diff) - { - for (uint8 i = 0; i < MAX_ACTIVE_LACKEY; ++i) + boss_priestess_lackey_commonAI::UpdateAI(diff); + + if (Goblin_Dragon_Gun_Timer <= diff) { - if (Unit* pAdd = Unit::GetUnit(*me, m_auiLackeyGUIDs[i])) + DoCast(me->getVictim(), SPELL_GOBLIN_DRAGON_GUN); + Goblin_Dragon_Gun_Timer = 10000; + } else Goblin_Dragon_Gun_Timer -= diff; + + if (Rocket_Launch_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_ROCKET_LAUNCH); + Rocket_Launch_Timer = 9000; + } else Rocket_Launch_Timer -= diff; + + if (Fel_Iron_Bomb_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_FEL_IRON_BOMB); + Fel_Iron_Bomb_Timer = 15000; + } else Fel_Iron_Bomb_Timer -= diff; + + if (Recombobulate_Timer <= diff) + { + for (uint8 i = 0; i < MAX_ACTIVE_LACKEY; ++i) { - if (pAdd->IsPolymorphed()) + if (Unit* pAdd = Unit::GetUnit(*me, m_auiLackeyGUIDs[i])) { - DoCast(pAdd, SPELL_RECOMBOBULATE); - break; + if (pAdd->IsPolymorphed()) + { + DoCast(pAdd, SPELL_RECOMBOBULATE); + break; + } } } - } - Recombobulate_Timer = 2000; - } else Recombobulate_Timer -= diff; + Recombobulate_Timer = 2000; + } else Recombobulate_Timer -= diff; - if (High_Explosive_Sheep_Timer <= diff) - { - DoCast(me, SPELL_HIGH_EXPLOSIVE_SHEEP); - High_Explosive_Sheep_Timer = 65000; - } else High_Explosive_Sheep_Timer -= diff; + if (High_Explosive_Sheep_Timer <= diff) + { + DoCast(me, SPELL_HIGH_EXPLOSIVE_SHEEP); + High_Explosive_Sheep_Timer = 65000; + } else High_Explosive_Sheep_Timer -= diff; - DoMeleeAttackIfReady(); - } -}; + DoMeleeAttackIfReady(); + } + }; -CreatureAI* GetAI_zelfan(Creature* pCreature) +}; +
/*
class mob_high_explosive_sheep : public CreatureScript { - return new boss_zelfanAI(pCreature); -} +public: + mob_high_explosive_sheep() : CreatureScript("mob_high_explosive_sheep") { } -//struct mob_high_explosive_sheepAI : public ScriptedAI -//{ -// mob_high_explosive_sheepAI(Creature *c) : ScriptedAI(c) {} -// -// uint32 Explosion_Timer; -// -// void Reset() -// { -// Explosion_Timer = 60000; -// } -// -// void JustDied(Unit *Killer){} -// -// void EnterCombat(Unit * /*who*/){} -// -// void UpdateAI(const uint32 diff) -// { -// if (Explosion_Timer <= diff) -// { -// DoCast(me->getVictim(), SPELL_SHEEP_EXPLOSION); -// }else -// Explosion_Timer -= diff; -// } -//}; - -//CreatureAI* GetAI_mob_high_explosive_sheep(Creature* pCreature) -//{ -// return new mob_high_explosive_sheepAI (pCreature); -//}; + //CreatureAI* GetAI(Creature* pCreature) const + //{ + // return new mob_high_explosive_sheepAI (pCreature); + //}; +}; +*/ void AddSC_boss_priestess_delrissa() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_priestess_delrissa"; - newscript->GetAI = &GetAI_boss_priestess_delrissa; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_kagani_nightstrike"; - newscript->GetAI = &GetAI_boss_kagani_nightstrike; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_ellris_duskhallow"; - newscript->GetAI = &GetAI_ellris_duskhallow; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_eramas_brightblaze"; - newscript->GetAI = &GetAI_eramas_brightblaze; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_yazzai"; - newscript->GetAI = &GetAI_yazzai; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_warlord_salaris"; - newscript->GetAI = &GetAI_warlord_salaris; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_garaxxas"; - newscript->GetAI = &GetAI_garaxxas; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_apoko"; - newscript->GetAI = &GetAI_apoko; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_zelfan"; - newscript->GetAI = &GetAI_zelfan; - newscript->RegisterSelf(); - - /*newscript = new Script; - newscript->Name = "mob_high_explosive_sheep"; - newscript->GetAI = &GetAI_mob_high_explosive_sheep; - newscript->RegisterSelf();*/ + new boss_priestess_delrissa(); + new boss_kagani_nightstrike(); + new boss_ellris_duskhallow(); + new boss_eramas_brightblaze(); + new boss_yazzai(); + new boss_warlord_salaris(); + new boss_garaxxas(); + new boss_apoko(); + new boss_zelfan(); + // new mob_high_explosive_sheep(); } - diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp index 65acb074cea..f2ea2d25fbd 100644 --- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp +++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp @@ -50,319 +50,323 @@ EndScriptData */ #define DATA_CRYSTALS 6 #define CREATURE_FEL_CRYSTAL 24722 - -struct boss_selin_fireheartAI : public ScriptedAI +
class boss_selin_fireheart : public CreatureScript { - boss_selin_fireheartAI(Creature* c) : ScriptedAI(c) +public: + boss_selin_fireheart() : CreatureScript("boss_selin_fireheart") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_selin_fireheartAI (pCreature); + }; - Crystals.clear(); - //GUIDs per instance is static, so we only need to load them once. - if (pInstance) + struct boss_selin_fireheartAI : public ScriptedAI + { + boss_selin_fireheartAI(Creature* c) : ScriptedAI(c) { - uint32 size = pInstance->GetData(DATA_FEL_CRYSTAL_SIZE); - for (uint8 i = 0; i < size; ++i) + pInstance = c->GetInstanceScript(); + + Crystals.clear(); + //GUIDs per instance is static, so we only need to load them once. + if (pInstance) { - uint64 guid = pInstance->GetData64(DATA_FEL_CRYSTAL); - sLog.outDebug("TSCR: Selin: Adding Fel Crystal %u to list", guid); - Crystals.push_back(guid); + uint32 size = pInstance->GetData(DATA_FEL_CRYSTAL_SIZE); + for (uint8 i = 0; i < size; ++i) + { + uint64 guid = pInstance->GetData64(DATA_FEL_CRYSTAL); + sLog.outDebug("TSCR: Selin: Adding Fel Crystal %u to list", guid); + Crystals.push_back(guid); + } } } - } - ScriptedInstance* pInstance; + InstanceScript* pInstance; - std::list<uint64> Crystals; + std::list<uint64> Crystals; - uint32 DrainLifeTimer; - uint32 DrainManaTimer; - uint32 FelExplosionTimer; - uint32 DrainCrystalTimer; - uint32 EmpowerTimer; + uint32 DrainLifeTimer; + uint32 DrainManaTimer; + uint32 FelExplosionTimer; + uint32 DrainCrystalTimer; + uint32 EmpowerTimer; - bool IsDraining; - bool DrainingCrystal; + bool IsDraining; + bool DrainingCrystal; - uint64 CrystalGUID; // This will help us create a pointer to the crystal we are draining. We store GUIDs, never units in case unit is deleted/offline (offline if player of course). + uint64 CrystalGUID; // This will help us create a pointer to the crystal we are draining. We store GUIDs, never units in case unit is deleted/offline (offline if player of course). - void Reset() - { - if (pInstance) + void Reset() { - //for (uint8 i = 0; i < CRYSTALS_NUMBER; ++i) - for (std::list<uint64>::const_iterator itr = Crystals.begin(); itr != Crystals.end(); ++itr) + if (pInstance) { - //Unit* pUnit = Unit::GetUnit(*me, FelCrystals[i]); - Unit* pUnit = Unit::GetUnit(*me, *itr); - if (pUnit) + //for (uint8 i = 0; i < CRYSTALS_NUMBER; ++i) + for (std::list<uint64>::const_iterator itr = Crystals.begin(); itr != Crystals.end(); ++itr) { - if (!pUnit->isAlive()) - CAST_CRE(pUnit)->Respawn(); // Let the core handle setting death state, etc. + //Unit* pUnit = Unit::GetUnit(*me, FelCrystals[i]); + Unit* pUnit = Unit::GetUnit(*me, *itr); + if (pUnit) + { + if (!pUnit->isAlive()) + CAST_CRE(pUnit)->Respawn(); // Let the core handle setting death state, etc. - // Only need to set unselectable flag. You can't attack unselectable units so non_attackable flag is not necessary here. - pUnit->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + // Only need to set unselectable flag. You can't attack unselectable units so non_attackable flag is not necessary here. + pUnit->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + } } - } - pInstance->HandleGameObject(pInstance->GetData64(DATA_SELIN_ENCOUNTER_DOOR), true); - // Open the big encounter door. Close it in Aggro and open it only in JustDied(and here) - // Small door opened after event are expected to be closed by default - // Set Inst data for encounter - pInstance->SetData(DATA_SELIN_EVENT, NOT_STARTED); - } else sLog.outError(ERROR_INST_DATA); - - DrainLifeTimer = 3000 + rand()%4000; - DrainManaTimer = DrainLifeTimer + 5000; - FelExplosionTimer = 2100; - DrainCrystalTimer = 10000 + rand()%5000; - DrainCrystalTimer = 20000 + rand()%5000; - EmpowerTimer = 10000; - - IsDraining = false; - DrainingCrystal = false; - CrystalGUID = 0; - } - - void SelectNearestCrystal() - { - if (Crystals.empty()) - return; - - //float ShortestDistance = 0; - CrystalGUID = 0; - Unit* pCrystal = NULL; - Unit* CrystalChosen = NULL; - //for (uint8 i = 0; i < CRYSTALS_NUMBER; ++i) - for (std::list<uint64>::const_iterator itr = Crystals.begin(); itr != Crystals.end(); ++itr) + pInstance->HandleGameObject(pInstance->GetData64(DATA_SELIN_ENCOUNTER_DOOR), true); + // Open the big encounter door. Close it in Aggro and open it only in JustDied(and here) + // Small door opened after event are expected to be closed by default + // Set Inst data for encounter + pInstance->SetData(DATA_SELIN_EVENT, NOT_STARTED); + } else sLog.outError(ERROR_INST_DATA); + + DrainLifeTimer = 3000 + rand()%4000; + DrainManaTimer = DrainLifeTimer + 5000; + FelExplosionTimer = 2100; + DrainCrystalTimer = 10000 + rand()%5000; + DrainCrystalTimer = 20000 + rand()%5000; + EmpowerTimer = 10000; + + IsDraining = false; + DrainingCrystal = false; + CrystalGUID = 0; + } + + void SelectNearestCrystal() { - pCrystal = NULL; - //pCrystal = Unit::GetUnit(*me, FelCrystals[i]); - pCrystal = Unit::GetUnit(*me, *itr); - if (pCrystal && pCrystal->isAlive()) + if (Crystals.empty()) + return; + + //float ShortestDistance = 0; + CrystalGUID = 0; + Unit* pCrystal = NULL; + Unit* CrystalChosen = NULL; + //for (uint8 i = 0; i < CRYSTALS_NUMBER; ++i) + for (std::list<uint64>::const_iterator itr = Crystals.begin(); itr != Crystals.end(); ++itr) { - // select nearest - if (!CrystalChosen || me->GetDistanceOrder(pCrystal, CrystalChosen, false)) + pCrystal = NULL; + //pCrystal = Unit::GetUnit(*me, FelCrystals[i]); + pCrystal = Unit::GetUnit(*me, *itr); + if (pCrystal && pCrystal->isAlive()) { - CrystalGUID = pCrystal->GetGUID(); - CrystalChosen = pCrystal; // Store a copy of pCrystal so we don't need to recreate a pointer to closest crystal for the movement and yell. + // select nearest + if (!CrystalChosen || me->GetDistanceOrder(pCrystal, CrystalChosen, false)) + { + CrystalGUID = pCrystal->GetGUID(); + CrystalChosen = pCrystal; // Store a copy of pCrystal so we don't need to recreate a pointer to closest crystal for the movement and yell. + } } } - } - if (CrystalChosen) - { - DoScriptText(SAY_ENERGY, me); - DoScriptText(EMOTE_CRYSTAL, me); + if (CrystalChosen) + { + DoScriptText(SAY_ENERGY, me); + DoScriptText(EMOTE_CRYSTAL, me); - CrystalChosen->CastSpell(CrystalChosen, SPELL_FEL_CRYSTAL_COSMETIC, true); + CrystalChosen->CastSpell(CrystalChosen, SPELL_FEL_CRYSTAL_COSMETIC, true); - float x, y, z; // coords that we move to, close to the crystal. - CrystalChosen->GetClosePoint(x, y, z, me->GetObjectSize(), CONTACT_DISTANCE); + float x, y, z; // coords that we move to, close to the crystal. + CrystalChosen->GetClosePoint(x, y, z, me->GetObjectSize(), CONTACT_DISTANCE); - me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - me->GetMotionMaster()->MovePoint(1, x, y, z); - DrainingCrystal = true; + me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + me->GetMotionMaster()->MovePoint(1, x, y, z); + DrainingCrystal = true; + } } - } - - void ShatterRemainingCrystals() - { - if (Crystals.empty()) - return; - //for (uint8 i = 0; i < CRYSTALS_NUMBER; ++i) - for (std::list<uint64>::const_iterator itr = Crystals.begin(); itr != Crystals.end(); ++itr) + void ShatterRemainingCrystals() { - //Creature* pCrystal = (Unit::GetCreature(*me, FelCrystals[i])); - Creature* pCrystal = Unit::GetCreature(*me, *itr); - if (pCrystal && pCrystal->isAlive()) - pCrystal->Kill(pCrystal); + if (Crystals.empty()) + return; + + //for (uint8 i = 0; i < CRYSTALS_NUMBER; ++i) + for (std::list<uint64>::const_iterator itr = Crystals.begin(); itr != Crystals.end(); ++itr) + { + //Creature* pCrystal = (Unit::GetCreature(*me, FelCrystals[i])); + Creature* pCrystal = Unit::GetCreature(*me, *itr); + if (pCrystal && pCrystal->isAlive()) + pCrystal->Kill(pCrystal); + } } - } - void EnterCombat(Unit* /*who*/) - { - DoScriptText(SAY_AGGRO, me); + void EnterCombat(Unit* /*who*/) + { + DoScriptText(SAY_AGGRO, me); - if (pInstance) - pInstance->HandleGameObject(pInstance->GetData64(DATA_SELIN_ENCOUNTER_DOOR), false); - //Close the encounter door, open it in JustDied/Reset - } + if (pInstance) + pInstance->HandleGameObject(pInstance->GetData64(DATA_SELIN_ENCOUNTER_DOOR), false); + //Close the encounter door, open it in JustDied/Reset + } - void KilledUnit(Unit* /*victim*/) - { - DoScriptText(RAND(SAY_KILL_1,SAY_KILL_2), me); - } + void KilledUnit(Unit* /*victim*/) + { + DoScriptText(RAND(SAY_KILL_1,SAY_KILL_2), me); + } - void MovementInform(uint32 type, uint32 id) - { - if (type == POINT_MOTION_TYPE && id == 1) + void MovementInform(uint32 type, uint32 id) { - Unit* CrystalChosen = Unit::GetUnit(*me, CrystalGUID); - if (CrystalChosen && CrystalChosen->isAlive()) - { - // Make the crystal attackable - // We also remove NON_ATTACKABLE in case the database has it set. - CrystalChosen->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE + UNIT_FLAG_NOT_SELECTABLE); - CrystalChosen->CastSpell(me, SPELL_MANA_RAGE, true); - IsDraining = true; - } - else + if (type == POINT_MOTION_TYPE && id == 1) { - // Make an error message in case something weird happened here - sLog.outError("TSCR: Selin Fireheart unable to drain crystal as the crystal is either dead or despawned"); - DrainingCrystal = false; + Unit* CrystalChosen = Unit::GetUnit(*me, CrystalGUID); + if (CrystalChosen && CrystalChosen->isAlive()) + { + // Make the crystal attackable + // We also remove NON_ATTACKABLE in case the database has it set. + CrystalChosen->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE + UNIT_FLAG_NOT_SELECTABLE); + CrystalChosen->CastSpell(me, SPELL_MANA_RAGE, true); + IsDraining = true; + } + else + { + // Make an error message in case something weird happened here + sLog.outError("TSCR: Selin Fireheart unable to drain crystal as the crystal is either dead or despawned"); + DrainingCrystal = false; + } } } - } - - void JustDied(Unit* /*killer*/) - { - DoScriptText(SAY_DEATH, me); - if (!pInstance) - return; + void JustDied(Unit* /*killer*/) + { + DoScriptText(SAY_DEATH, me); - pInstance->SetData(DATA_SELIN_EVENT, DONE); // Encounter complete! - pInstance->HandleGameObject(pInstance->GetData64(DATA_SELIN_ENCOUNTER_DOOR), true); // Open the encounter door - pInstance->HandleGameObject(pInstance->GetData64(DATA_SELIN_DOOR), true); // Open the door leading further in - ShatterRemainingCrystals(); - } + if (!pInstance) + return; - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + pInstance->SetData(DATA_SELIN_EVENT, DONE); // Encounter complete! + pInstance->HandleGameObject(pInstance->GetData64(DATA_SELIN_ENCOUNTER_DOOR), true); // Open the encounter door + pInstance->HandleGameObject(pInstance->GetData64(DATA_SELIN_DOOR), true); // Open the door leading further in + ShatterRemainingCrystals(); + } - if (!DrainingCrystal) + void UpdateAI(const uint32 diff) { - uint32 maxPowerMana = me->GetMaxPower(POWER_MANA); - if (maxPowerMana && ((me->GetPower(POWER_MANA)*100 / maxPowerMana) < 10)) + if (!UpdateVictim()) + return; + + if (!DrainingCrystal) { - if (DrainLifeTimer <= diff) + uint32 maxPowerMana = me->GetMaxPower(POWER_MANA); + if (maxPowerMana && ((me->GetPower(POWER_MANA)*100 / maxPowerMana) < 10)) { - DoCast(SelectUnit(SELECT_TARGET_RANDOM, 0), SPELL_DRAIN_LIFE); - DrainLifeTimer = 10000; - } else DrainLifeTimer -= diff; + if (DrainLifeTimer <= diff) + { + DoCast(SelectUnit(SELECT_TARGET_RANDOM, 0), SPELL_DRAIN_LIFE); + DrainLifeTimer = 10000; + } else DrainLifeTimer -= diff; - // Heroic only - if (IsHeroic()) - { - if (DrainManaTimer <= diff) + // Heroic only + if (IsHeroic()) { - DoCast(SelectUnit(SELECT_TARGET_RANDOM, 1), SPELL_DRAIN_MANA); - DrainManaTimer = 10000; - } else DrainManaTimer -= diff; + if (DrainManaTimer <= diff) + { + DoCast(SelectUnit(SELECT_TARGET_RANDOM, 1), SPELL_DRAIN_MANA); + DrainManaTimer = 10000; + } else DrainManaTimer -= diff; + } } - } - if (FelExplosionTimer <= diff) - { - if (!me->IsNonMeleeSpellCasted(false)) + if (FelExplosionTimer <= diff) { - DoCast(me, SPELL_FEL_EXPLOSION); - FelExplosionTimer = 2000; - } - } else FelExplosionTimer -= diff; + if (!me->IsNonMeleeSpellCasted(false)) + { + DoCast(me, SPELL_FEL_EXPLOSION); + FelExplosionTimer = 2000; + } + } else FelExplosionTimer -= diff; - // If below 10% mana, start recharging - maxPowerMana = me->GetMaxPower(POWER_MANA); - if (maxPowerMana && ((me->GetPower(POWER_MANA)*100 / maxPowerMana) < 10)) - { - if (DrainCrystalTimer <= diff) + // If below 10% mana, start recharging + maxPowerMana = me->GetMaxPower(POWER_MANA); + if (maxPowerMana && ((me->GetPower(POWER_MANA)*100 / maxPowerMana) < 10)) { - SelectNearestCrystal(); - if (IsHeroic()) - DrainCrystalTimer = 10000 + rand()%5000; - else - DrainCrystalTimer = 20000 + rand()%5000; - } else DrainCrystalTimer -= diff; - } + if (DrainCrystalTimer <= diff) + { + SelectNearestCrystal(); + if (IsHeroic()) + DrainCrystalTimer = 10000 + rand()%5000; + else + DrainCrystalTimer = 20000 + rand()%5000; + } else DrainCrystalTimer -= diff; + } - }else - { - if (IsDraining) + }else { - if (EmpowerTimer <= diff) + if (IsDraining) { - IsDraining = false; - DrainingCrystal = false; + if (EmpowerTimer <= diff) + { + IsDraining = false; + DrainingCrystal = false; - DoScriptText(SAY_EMPOWERED, me); + DoScriptText(SAY_EMPOWERED, me); - Unit* CrystalChosen = Unit::GetUnit(*me, CrystalGUID); - if (CrystalChosen && CrystalChosen->isAlive()) - // Use Deal Damage to kill it, not setDeathState. - CrystalChosen->Kill(CrystalChosen); + Unit* CrystalChosen = Unit::GetUnit(*me, CrystalGUID); + if (CrystalChosen && CrystalChosen->isAlive()) + // Use Deal Damage to kill it, not setDeathState. + CrystalChosen->Kill(CrystalChosen); - CrystalGUID = 0; + CrystalGUID = 0; - me->GetMotionMaster()->Clear(); - me->GetMotionMaster()->MoveChase(me->getVictim()); - } else EmpowerTimer -= diff; + me->GetMotionMaster()->Clear(); + me->GetMotionMaster()->MoveChase(me->getVictim()); + } else EmpowerTimer -= diff; + } } + + DoMeleeAttackIfReady(); // No need to check if we are draining crystal here, as the spell has a stun. } + }; - DoMeleeAttackIfReady(); // No need to check if we are draining crystal here, as the spell has a stun. - } }; -CreatureAI* GetAI_boss_selin_fireheart(Creature* pCreature) +
class mob_fel_crystal : public CreatureScript { - return new boss_selin_fireheartAI (pCreature); -}; +public: + mob_fel_crystal() : CreatureScript("mob_fel_crystal") { } -struct mob_fel_crystalAI : public ScriptedAI -{ - mob_fel_crystalAI(Creature *c) : ScriptedAI(c) {} - - void Reset() {} - void EnterCombat(Unit* /*who*/) {} - void AttackStart(Unit* /*who*/) {} - void MoveInLineOfSight(Unit* /*who*/) {} - void UpdateAI(const uint32 /*diff*/) {} + CreatureAI* GetAI(Creature* pCreature) const + { + return new mob_fel_crystalAI (pCreature); + }; - void JustDied(Unit* /*killer*/) + struct mob_fel_crystalAI : public ScriptedAI { - if (ScriptedInstance* pInstance = me->GetInstanceData()) + mob_fel_crystalAI(Creature *c) : ScriptedAI(c) {} + + void Reset() {} + void EnterCombat(Unit* /*who*/) {} + void AttackStart(Unit* /*who*/) {} + void MoveInLineOfSight(Unit* /*who*/) {} + void UpdateAI(const uint32 /*diff*/) {} + + void JustDied(Unit* /*killer*/) { - Creature* Selin = (Unit::GetCreature(*me, pInstance->GetData64(DATA_SELIN))); - if (Selin && Selin->isAlive()) + if (InstanceScript* pInstance = me->GetInstanceScript()) { - if (CAST_AI(boss_selin_fireheartAI, Selin->AI())->CrystalGUID == me->GetGUID()) + Creature* Selin = (Unit::GetCreature(*me, pInstance->GetData64(DATA_SELIN))); + if (Selin && Selin->isAlive()) { - // Set this to false if we are the Creature that Selin is draining so his AI flows properly - CAST_AI(boss_selin_fireheartAI, Selin->AI())->DrainingCrystal = false; - CAST_AI(boss_selin_fireheartAI, Selin->AI())->IsDraining = false; - CAST_AI(boss_selin_fireheartAI, Selin->AI())->EmpowerTimer = 10000; - if (Selin->getVictim()) + if (CAST_AI(boss_selin_fireheart::boss_selin_fireheartAI, Selin->AI())->CrystalGUID == me->GetGUID()) { - Selin->AI()->AttackStart(Selin->getVictim()); - Selin->GetMotionMaster()->MoveChase(Selin->getVictim()); + // Set this to false if we are the Creature that Selin is draining so his AI flows properly + CAST_AI(boss_selin_fireheart::boss_selin_fireheartAI, Selin->AI())->DrainingCrystal = false; + CAST_AI(boss_selin_fireheart::boss_selin_fireheartAI, Selin->AI())->IsDraining = false; + CAST_AI(boss_selin_fireheart::boss_selin_fireheartAI, Selin->AI())->EmpowerTimer = 10000; + if (Selin->getVictim()) + { + Selin->AI()->AttackStart(Selin->getVictim()); + Selin->GetMotionMaster()->MoveChase(Selin->getVictim()); + } } } - } - } else sLog.outError(ERROR_INST_DATA); - } -}; + } else sLog.outError(ERROR_INST_DATA); + } + }; -CreatureAI* GetAI_mob_fel_crystal(Creature* pCreature) -{ - return new mob_fel_crystalAI (pCreature); }; + void AddSC_boss_selin_fireheart() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_selin_fireheart"; - newscript->GetAI = &GetAI_boss_selin_fireheart; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_fel_crystal"; - newscript->GetAI = &GetAI_mob_fel_crystal; - newscript->RegisterSelf(); + new boss_selin_fireheart(); + new mob_fel_crystal(); } - diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_vexallus.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_vexallus.cpp index c89c7683749..ad70057f5bd 100644 --- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_vexallus.cpp +++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_vexallus.cpp @@ -58,171 +58,176 @@ enum eEnums INTERVAL_MODIFIER = 15, INTERVAL_SWITCH = 6 }; - -struct boss_vexallusAI : public ScriptedAI +
class boss_vexallus : public CreatureScript { - boss_vexallusAI(Creature *c) : ScriptedAI(c) - { - pInstance = c->GetInstanceData(); - } +public: + boss_vexallus() : CreatureScript("boss_vexallus") { } - ScriptedInstance* pInstance; - - uint32 ChainLightningTimer; - uint32 ArcaneShockTimer; - uint32 OverloadTimer; - uint32 IntervalHealthAmount; - bool Enraged; + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_vexallusAI (pCreature); + }; - void Reset() + struct boss_vexallusAI : public ScriptedAI { - ChainLightningTimer = 8000; - ArcaneShockTimer = 5000; - OverloadTimer = 1200; - IntervalHealthAmount = 1; - Enraged = false; + boss_vexallusAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } - if (pInstance) - pInstance->SetData(DATA_VEXALLUS_EVENT, NOT_STARTED); - } + InstanceScript* pInstance; - void KilledUnit(Unit * /*victim*/) - { - DoScriptText(SAY_KILL, me); - } + uint32 ChainLightningTimer; + uint32 ArcaneShockTimer; + uint32 OverloadTimer; + uint32 IntervalHealthAmount; + bool Enraged; - void JustDied(Unit * /*victim*/) - { - if (pInstance) - pInstance->SetData(DATA_VEXALLUS_EVENT, DONE); - } + void Reset() + { + ChainLightningTimer = 8000; + ArcaneShockTimer = 5000; + OverloadTimer = 1200; + IntervalHealthAmount = 1; + Enraged = false; + + if (pInstance) + pInstance->SetData(DATA_VEXALLUS_EVENT, NOT_STARTED); + } - void EnterCombat(Unit * /*who*/) - { - DoScriptText(SAY_AGGRO, me); + void KilledUnit(Unit * /*victim*/) + { + DoScriptText(SAY_KILL, me); + } - if (pInstance) - pInstance->SetData(DATA_VEXALLUS_EVENT, IN_PROGRESS); - } + void JustDied(Unit * /*victim*/) + { + if (pInstance) + pInstance->SetData(DATA_VEXALLUS_EVENT, DONE); + } - void JustSummoned(Creature *summoned) - { - if (Unit *temp = SelectUnit(SELECT_TARGET_RANDOM, 0)) - summoned->GetMotionMaster()->MoveFollow(temp,0,0); + void EnterCombat(Unit * /*who*/) + { + DoScriptText(SAY_AGGRO, me); - //spells are SUMMON_TYPE_GUARDIAN, so using setOwner should be ok - summoned->CastSpell(summoned,SPELL_ENERGY_BOLT,false,0,0,me->GetGUID()); - } + if (pInstance) + pInstance->SetData(DATA_VEXALLUS_EVENT, IN_PROGRESS); + } - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + void JustSummoned(Creature *summoned) + { + if (Unit *temp = SelectUnit(SELECT_TARGET_RANDOM, 0)) + summoned->GetMotionMaster()->MoveFollow(temp,0,0); - if (!Enraged) + //spells are SUMMON_TYPE_GUARDIAN, so using setOwner should be ok + summoned->CastSpell(summoned,SPELL_ENERGY_BOLT,false,0,0,me->GetGUID()); + } + + void UpdateAI(const uint32 diff) { - //used for check, when Vexallus cast adds 85%, 70%, 55%, 40%, 25% - if ((me->GetHealth()*100 / me->GetMaxHealth()) <= (100-(INTERVAL_MODIFIER*IntervalHealthAmount))) + if (!UpdateVictim()) + return; + + if (!Enraged) { - //increase amount, unless we're at 10%, then we switch and return - if (IntervalHealthAmount == INTERVAL_SWITCH) + //used for check, when Vexallus cast adds 85%, 70%, 55%, 40%, 25% + if ((me->GetHealth()*100 / me->GetMaxHealth()) <= (100-(INTERVAL_MODIFIER*IntervalHealthAmount))) { - Enraged = true; - return; - } - else - ++IntervalHealthAmount; - - DoScriptText(SAY_ENERGY, me); - DoScriptText(EMOTE_DISCHARGE_ENERGY, me); + //increase amount, unless we're at 10%, then we switch and return + if (IntervalHealthAmount == INTERVAL_SWITCH) + { + Enraged = true; + return; + } + else + ++IntervalHealthAmount; + + DoScriptText(SAY_ENERGY, me); + DoScriptText(EMOTE_DISCHARGE_ENERGY, me); + + if (IsHeroic()) + { + DoCast(me, H_SPELL_SUMMON_PURE_ENERGY1, false); + DoCast(me, H_SPELL_SUMMON_PURE_ENERGY2, false); + } + else + DoCast(me, SPELL_SUMMON_PURE_ENERGY, false); + + //below are workaround summons, remove when summoning spells w/implicitTarget 73 implemented in the core + me->SummonCreature(NPC_PURE_ENERGY, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_CORPSE_DESPAWN, 0); - if (IsHeroic()) - { - DoCast(me, H_SPELL_SUMMON_PURE_ENERGY1, false); - DoCast(me, H_SPELL_SUMMON_PURE_ENERGY2, false); + if (IsHeroic()) + me->SummonCreature(NPC_PURE_ENERGY, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_CORPSE_DESPAWN, 0); } - else - DoCast(me, SPELL_SUMMON_PURE_ENERGY, false); - - //below are workaround summons, remove when summoning spells w/implicitTarget 73 implemented in the core - me->SummonCreature(NPC_PURE_ENERGY, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_CORPSE_DESPAWN, 0); - if (IsHeroic()) - me->SummonCreature(NPC_PURE_ENERGY, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_CORPSE_DESPAWN, 0); - } + if (ChainLightningTimer <= diff) + { + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, SPELL_CHAIN_LIGHTNING); - if (ChainLightningTimer <= diff) - { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget, SPELL_CHAIN_LIGHTNING); + ChainLightningTimer = 8000; + } else ChainLightningTimer -= diff; - ChainLightningTimer = 8000; - } else ChainLightningTimer -= diff; + if (ArcaneShockTimer <= diff) + { + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + if (pTarget) + DoCast(pTarget, SPELL_ARCANE_SHOCK); - if (ArcaneShockTimer <= diff) + ArcaneShockTimer = 8000; + } else ArcaneShockTimer -= diff; + } + else { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - if (pTarget) - DoCast(pTarget, SPELL_ARCANE_SHOCK); + if (OverloadTimer <= diff) + { + DoCast(me->getVictim(), SPELL_OVERLOAD); - ArcaneShockTimer = 8000; - } else ArcaneShockTimer -= diff; - } - else - { - if (OverloadTimer <= diff) - { - DoCast(me->getVictim(), SPELL_OVERLOAD); + OverloadTimer = 2000; + } else OverloadTimer -= diff; + } - OverloadTimer = 2000; - } else OverloadTimer -= diff; + DoMeleeAttackIfReady(); } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_vexallus(Creature* pCreature) +
class mob_pure_energy : public CreatureScript { - return new boss_vexallusAI (pCreature); -}; - -struct mob_pure_energyAI : public ScriptedAI -{ - mob_pure_energyAI(Creature *c) : ScriptedAI(c) {} +public: + mob_pure_energy() : CreatureScript("mob_pure_energy") { } - void Reset() {} + CreatureAI* GetAI(Creature* pCreature) const + { + return new mob_pure_energyAI (pCreature); + }; - void JustDied(Unit* slayer) + struct mob_pure_energyAI : public ScriptedAI { - if (Unit *temp = me->GetOwner()) + mob_pure_energyAI(Creature *c) : ScriptedAI(c) {} + + void Reset() {} + + void JustDied(Unit* slayer) { - if (temp && temp->isAlive()) - slayer->CastSpell(slayer, SPELL_ENERGY_FEEDBACK, true, 0, 0, temp->GetGUID()); + if (Unit *temp = me->GetOwner()) + { + if (temp && temp->isAlive()) + slayer->CastSpell(slayer, SPELL_ENERGY_FEEDBACK, true, 0, 0, temp->GetGUID()); + } } - } - void EnterCombat(Unit * /*who*/) {} - void MoveInLineOfSight(Unit * /*who*/) {} - void AttackStart(Unit * /*who*/) {} -}; + void EnterCombat(Unit * /*who*/) {} + void MoveInLineOfSight(Unit * /*who*/) {} + void AttackStart(Unit * /*who*/) {} + }; -CreatureAI* GetAI_mob_pure_energy(Creature* pCreature) -{ - return new mob_pure_energyAI (pCreature); }; + void AddSC_boss_vexallus() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_vexallus"; - newscript->GetAI = &GetAI_boss_vexallus; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_pure_energy"; - newscript->GetAI = &GetAI_mob_pure_energy; - newscript->RegisterSelf(); + new boss_vexallus(); + new mob_pure_energy(); } diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/instance_magisters_terrace.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/instance_magisters_terrace.cpp index ab1bf3b04d1..985466f4d8c 100644 --- a/src/server/scripts/EasternKingdoms/MagistersTerrace/instance_magisters_terrace.cpp +++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/instance_magisters_terrace.cpp @@ -34,174 +34,175 @@ EndScriptData */ 2 - Priestess Delrissa 3 - Kael'thas Sunstrider */ - -struct instance_magisters_terrace : public ScriptedInstance +
class instance_magisters_terrace : public InstanceMapScript { - instance_magisters_terrace(Map* pMap) : ScriptedInstance(pMap) {Initialize();} +public: + instance_magisters_terrace() : InstanceMapScript("instance_magisters_terrace") { } - uint32 m_auiEncounter[MAX_ENCOUNTER]; - uint32 DelrissaDeathCount; + InstanceScript* GetInstanceData_InstanceMapScript(Map* pMap) + { + return new instance_magisters_terrace_InstanceMapScript(pMap); + } - std::list<uint64> FelCrystals; - std::list<uint64>::const_iterator CrystalItr; + struct instance_magisters_terrace_InstanceMapScript : public InstanceScript + { + instance_magisters_terrace_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {Initialize();} - uint64 SelinGUID; - uint64 DelrissaGUID; - uint64 VexallusDoorGUID; - uint64 SelinDoorGUID; - uint64 SelinEncounterDoorGUID; - uint64 DelrissaDoorGUID; - uint64 KaelDoorGUID; - uint64 KaelStatue[2]; + uint32 m_auiEncounter[MAX_ENCOUNTER]; + uint32 DelrissaDeathCount; - bool InitializedItr; + std::list<uint64> FelCrystals; + std::list<uint64>::const_iterator CrystalItr; - void Initialize() - { - memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); + uint64 SelinGUID; + uint64 DelrissaGUID; + uint64 VexallusDoorGUID; + uint64 SelinDoorGUID; + uint64 SelinEncounterDoorGUID; + uint64 DelrissaDoorGUID; + uint64 KaelDoorGUID; + uint64 KaelStatue[2]; - FelCrystals.clear(); + bool InitializedItr; - DelrissaDeathCount = 0; + void Initialize() + { + memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - SelinGUID = 0; - DelrissaGUID = 0; - VexallusDoorGUID = 0; - SelinDoorGUID = 0; - SelinEncounterDoorGUID = 0; - DelrissaDoorGUID = 0; - KaelDoorGUID = 0; - KaelStatue[0] = 0; - KaelStatue[1] = 0; + FelCrystals.clear(); - InitializedItr = false; - } + DelrissaDeathCount = 0; - bool IsEncounterInProgress() const - { - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) - return true; - return false; - } + SelinGUID = 0; + DelrissaGUID = 0; + VexallusDoorGUID = 0; + SelinDoorGUID = 0; + SelinEncounterDoorGUID = 0; + DelrissaDoorGUID = 0; + KaelDoorGUID = 0; + KaelStatue[0] = 0; + KaelStatue[1] = 0; - uint32 GetData(uint32 identifier) - { - switch(identifier) + InitializedItr = false; + } + + bool IsEncounterInProgress() const { - case DATA_SELIN_EVENT: return m_auiEncounter[0]; - case DATA_VEXALLUS_EVENT: return m_auiEncounter[1]; - case DATA_DELRISSA_EVENT: return m_auiEncounter[2]; - case DATA_KAELTHAS_EVENT: return m_auiEncounter[3]; - case DATA_DELRISSA_DEATH_COUNT: return DelrissaDeathCount; - case DATA_FEL_CRYSTAL_SIZE: return FelCrystals.size(); + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + if (m_auiEncounter[i] == IN_PROGRESS) + return true; + return false; } - return 0; - } - void SetData(uint32 identifier, uint32 data) - { - switch(identifier) + uint32 GetData(uint32 identifier) { - case DATA_SELIN_EVENT: m_auiEncounter[0] = data; break; - case DATA_VEXALLUS_EVENT: - if (data == DONE) - DoUseDoorOrButton(VexallusDoorGUID); - m_auiEncounter[1] = data; - break; - case DATA_DELRISSA_EVENT: - if (data == DONE) - DoUseDoorOrButton(DelrissaDoorGUID); - if (data == IN_PROGRESS) - DelrissaDeathCount = 0; - m_auiEncounter[2] = data; - break; - case DATA_KAELTHAS_EVENT: m_auiEncounter[3] = data; break; - - case DATA_DELRISSA_DEATH_COUNT: - if (data == SPECIAL) - ++DelrissaDeathCount; - else - DelrissaDeathCount = 0; - break; + switch(identifier) + { + case DATA_SELIN_EVENT: return m_auiEncounter[0]; + case DATA_VEXALLUS_EVENT: return m_auiEncounter[1]; + case DATA_DELRISSA_EVENT: return m_auiEncounter[2]; + case DATA_KAELTHAS_EVENT: return m_auiEncounter[3]; + case DATA_DELRISSA_DEATH_COUNT: return DelrissaDeathCount; + case DATA_FEL_CRYSTAL_SIZE: return FelCrystals.size(); + } + return 0; } - } - void OnCreatureCreate(Creature* pCreature, bool /*add*/) - { - switch(pCreature->GetEntry()) + void SetData(uint32 identifier, uint32 data) { - case 24723: SelinGUID = pCreature->GetGUID(); break; - case 24560: DelrissaGUID = pCreature->GetGUID(); break; - case 24722: FelCrystals.push_back(pCreature->GetGUID()); break; + switch(identifier) + { + case DATA_SELIN_EVENT: m_auiEncounter[0] = data; break; + case DATA_VEXALLUS_EVENT: + if (data == DONE) + DoUseDoorOrButton(VexallusDoorGUID); + m_auiEncounter[1] = data; + break; + case DATA_DELRISSA_EVENT: + if (data == DONE) + DoUseDoorOrButton(DelrissaDoorGUID); + if (data == IN_PROGRESS) + DelrissaDeathCount = 0; + m_auiEncounter[2] = data; + break; + case DATA_KAELTHAS_EVENT: m_auiEncounter[3] = data; break; + + case DATA_DELRISSA_DEATH_COUNT: + if (data == SPECIAL) + ++DelrissaDeathCount; + else + DelrissaDeathCount = 0; + break; + } } - } - void OnGameObjectCreate(GameObject* pGo, bool /*add*/) - { - switch(pGo->GetEntry()) + void OnCreatureCreate(Creature* pCreature, bool /*add*/) { - case 187896: VexallusDoorGUID = pGo->GetGUID(); break; - //SunwellRaid Gate 02 - case 187979: SelinDoorGUID = pGo->GetGUID(); break; - //Assembly Chamber Door - case 188065: SelinEncounterDoorGUID = pGo->GetGUID(); break; - case 187770: DelrissaDoorGUID = pGo->GetGUID(); break; - case 188064: KaelDoorGUID = pGo->GetGUID(); break; - case 188165: KaelStatue[0] = pGo->GetGUID(); break; - case 188166: KaelStatue[1] = pGo->GetGUID(); break; + switch(pCreature->GetEntry()) + { + case 24723: SelinGUID = pCreature->GetGUID(); break; + case 24560: DelrissaGUID = pCreature->GetGUID(); break; + case 24722: FelCrystals.push_back(pCreature->GetGUID()); break; + } } - } - uint64 GetData64(uint32 identifier) - { - switch(identifier) + void OnGameObjectCreate(GameObject* pGo, bool /*add*/) { - case DATA_SELIN: return SelinGUID; - case DATA_DELRISSA: return DelrissaGUID; - case DATA_VEXALLUS_DOOR: return VexallusDoorGUID; - case DATA_SELIN_DOOR: return SelinDoorGUID; - case DATA_SELIN_ENCOUNTER_DOOR: return SelinEncounterDoorGUID; - case DATA_DELRISSA_DOOR: return DelrissaDoorGUID; - case DATA_KAEL_DOOR: return KaelDoorGUID; - case DATA_KAEL_STATUE_LEFT: return KaelStatue[0]; - case DATA_KAEL_STATUE_RIGHT: return KaelStatue[1]; - - case DATA_FEL_CRYSTAL: + switch(pGo->GetEntry()) { - if (FelCrystals.empty()) - { - sLog.outError("TSCR: Magisters Terrace: No Fel Crystals loaded in Inst Data"); - return 0; - } + case 187896: VexallusDoorGUID = pGo->GetGUID(); break; + //SunwellRaid Gate 02 + case 187979: SelinDoorGUID = pGo->GetGUID(); break; + //Assembly Chamber Door + case 188065: SelinEncounterDoorGUID = pGo->GetGUID(); break; + case 187770: DelrissaDoorGUID = pGo->GetGUID(); break; + case 188064: KaelDoorGUID = pGo->GetGUID(); break; + case 188165: KaelStatue[0] = pGo->GetGUID(); break; + case 188166: KaelStatue[1] = pGo->GetGUID(); break; + } + } - if (!InitializedItr) + uint64 GetData64(uint32 identifier) + { + switch(identifier) + { + case DATA_SELIN: return SelinGUID; + case DATA_DELRISSA: return DelrissaGUID; + case DATA_VEXALLUS_DOOR: return VexallusDoorGUID; + case DATA_SELIN_DOOR: return SelinDoorGUID; + case DATA_SELIN_ENCOUNTER_DOOR: return SelinEncounterDoorGUID; + case DATA_DELRISSA_DOOR: return DelrissaDoorGUID; + case DATA_KAEL_DOOR: return KaelDoorGUID; + case DATA_KAEL_STATUE_LEFT: return KaelStatue[0]; + case DATA_KAEL_STATUE_RIGHT: return KaelStatue[1]; + + case DATA_FEL_CRYSTAL: { - CrystalItr = FelCrystals.begin(); - InitializedItr = true; + if (FelCrystals.empty()) + { + sLog.outError("TSCR: Magisters Terrace: No Fel Crystals loaded in Inst Data"); + return 0; + } + + if (!InitializedItr) + { + CrystalItr = FelCrystals.begin(); + InitializedItr = true; + } + + uint64 guid = *CrystalItr; + ++CrystalItr; + return guid; } - - uint64 guid = *CrystalItr; - ++CrystalItr; - return guid; } + return 0; } - return 0; - } + }; + }; -InstanceData* GetInstanceData_instance_magisters_terrace(Map* pMap) -{ - return new instance_magisters_terrace(pMap); -} void AddSC_instance_magisters_terrace() { - Script *newscript; - - newscript = new Script; - newscript->Name = "instance_magisters_terrace"; - newscript->GetInstanceData = &GetInstanceData_instance_magisters_terrace; - newscript->RegisterSelf(); + new instance_magisters_terrace(); } - diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.cpp index f6f1631fa6a..71c6cb44117 100644 --- a/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.cpp +++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.cpp @@ -50,127 +50,129 @@ const float afKaelLandPoint[] = {225.045, -276.236, -5.434}; #define GOSSIP_ITEM_KAEL_5 "What would Kil'jaeden want with a mortal woman?" // This is friendly keal that appear after used Orb. -// If we assume DB handle summon, summon appear somewhere outside the platform where Orb is -struct npc_kalecgosAI : public ScriptedAI +// If we assume DB handle summon, summon appear somewhere outside the platform where Orb is
class npc_kalecgos : public CreatureScript { - npc_kalecgosAI(Creature* pCreature) : ScriptedAI(pCreature) {} +public: + npc_kalecgos() : CreatureScript("npc_kalecgos") { } - uint32 m_uiTransformTimer; - - void Reset() + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - m_uiTransformTimer = 0; + switch(uiAction) + { + case GOSSIP_ACTION_INFO_DEF: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_KAEL_2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + pPlayer->SEND_GOSSIP_MENU(12500, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+1: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_KAEL_3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + pPlayer->SEND_GOSSIP_MENU(12502, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+2: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_KAEL_4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); + pPlayer->SEND_GOSSIP_MENU(12606, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+3: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_KAEL_5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4); + pPlayer->SEND_GOSSIP_MENU(12607, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+4: + pPlayer->SEND_GOSSIP_MENU(12608, pCreature->GetGUID()); + break; + } - // we must assume he appear as dragon somewhere outside the platform of orb, and then move directly to here - if (me->GetEntry() != NPC_KAEL) - me->GetMotionMaster()->MovePoint(POINT_ID_LAND, afKaelLandPoint[0], afKaelLandPoint[1], afKaelLandPoint[2]); + return true; } - void MovementInform(uint32 uiType, uint32 uiPointId) + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - if (uiType != POINT_MOTION_TYPE) - return; + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if (uiPointId == POINT_ID_LAND) - m_uiTransformTimer = MINUTE*IN_MILLISECONDS; + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_KAEL_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); + pPlayer->SEND_GOSSIP_MENU(12498, pCreature->GetGUID()); + + return true; } - // some targeting issues with the spell, so use this workaround as temporary solution - void DoWorkaroundForQuestCredit() + CreatureAI* GetAI(Creature* pCreature) const { - Map* pMap = me->GetMap(); + return new npc_kalecgosAI(pCreature); + } - if (!pMap || pMap->IsHeroic()) - return; + struct npc_kalecgosAI : public ScriptedAI + { + npc_kalecgosAI(Creature* pCreature) : ScriptedAI(pCreature) {} - Map::PlayerList const &lList = pMap->GetPlayers(); + uint32 m_uiTransformTimer; - if (lList.isEmpty()) - return; + void Reset() + { + m_uiTransformTimer = 0; - SpellEntry const* pSpell = GetSpellStore()->LookupEntry(SPELL_ORB_KILL_CREDIT); + // we must assume he appear as dragon somewhere outside the platform of orb, and then move directly to here + if (me->GetEntry() != NPC_KAEL) + me->GetMotionMaster()->MovePoint(POINT_ID_LAND, afKaelLandPoint[0], afKaelLandPoint[1], afKaelLandPoint[2]); + } - for (Map::PlayerList::const_iterator i = lList.begin(); i != lList.end(); ++i) + void MovementInform(uint32 uiType, uint32 uiPointId) { - if (Player* pPlayer = i->getSource()) + if (uiType != POINT_MOTION_TYPE) + return; + + if (uiPointId == POINT_ID_LAND) + m_uiTransformTimer = MINUTE*IN_MILLISECONDS; + } + + // some targeting issues with the spell, so use this workaround as temporary solution + void DoWorkaroundForQuestCredit() + { + Map* pMap = me->GetMap(); + + if (!pMap || pMap->IsHeroic()) + return; + + Map::PlayerList const &lList = pMap->GetPlayers(); + + if (lList.isEmpty()) + return; + + SpellEntry const* pSpell = GetSpellStore()->LookupEntry(SPELL_ORB_KILL_CREDIT); + + for (Map::PlayerList::const_iterator i = lList.begin(); i != lList.end(); ++i) { - if (pSpell && pSpell->EffectMiscValue[0]) - pPlayer->KilledMonsterCredit(pSpell->EffectMiscValue[0], 0); + if (Player* pPlayer = i->getSource()) + { + if (pSpell && pSpell->EffectMiscValue[0]) + pPlayer->KilledMonsterCredit(pSpell->EffectMiscValue[0], 0); + } } } - } - void UpdateAI(const uint32 uiDiff) - { - if (m_uiTransformTimer) + void UpdateAI(const uint32 uiDiff) { - if (m_uiTransformTimer <= uiDiff) + if (m_uiTransformTimer) { - DoCast(me, SPELL_ORB_KILL_CREDIT, false); - DoWorkaroundForQuestCredit(); + if (m_uiTransformTimer <= uiDiff) + { + DoCast(me, SPELL_ORB_KILL_CREDIT, false); + DoWorkaroundForQuestCredit(); - // Transform and update entry, now ready for quest/read gossip - DoCast(me, SPELL_TRANSFORM_TO_KAEL, false); - me->UpdateEntry(NPC_KAEL); + // Transform and update entry, now ready for quest/read gossip + DoCast(me, SPELL_TRANSFORM_TO_KAEL, false); + me->UpdateEntry(NPC_KAEL); - m_uiTransformTimer = 0; - } else m_uiTransformTimer -= uiDiff; + m_uiTransformTimer = 0; + } else m_uiTransformTimer -= uiDiff; + } } - } -}; - -CreatureAI* GetAI_npc_kalecgos(Creature* pCreature) -{ - return new npc_kalecgosAI(pCreature); -} + }; -bool GossipHello_npc_kalecgos(Player* pPlayer, Creature* pCreature) -{ - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_KAEL_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - pPlayer->SEND_GOSSIP_MENU(12498, pCreature->GetGUID()); +}; - return true; -} -bool GossipSelect_npc_kalecgos(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - switch(uiAction) - { - case GOSSIP_ACTION_INFO_DEF: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_KAEL_2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - pPlayer->SEND_GOSSIP_MENU(12500, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+1: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_KAEL_3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - pPlayer->SEND_GOSSIP_MENU(12502, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+2: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_KAEL_4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); - pPlayer->SEND_GOSSIP_MENU(12606, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+3: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_KAEL_5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4); - pPlayer->SEND_GOSSIP_MENU(12607, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+4: - pPlayer->SEND_GOSSIP_MENU(12608, pCreature->GetGUID()); - break; - } - return true; -} void AddSC_magisters_terrace() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_kalecgos"; - newscript->GetAI = &GetAI_npc_kalecgos; - newscript->pGossipHello = &GossipHello_npc_kalecgos; - newscript->pGossipSelect = &GossipSelect_npc_kalecgos; - newscript->RegisterSelf(); + new npc_kalecgos(); } diff --git a/src/server/scripts/EasternKingdoms/MoltenCore/boss_baron_geddon.cpp b/src/server/scripts/EasternKingdoms/MoltenCore/boss_baron_geddon.cpp index 86894f75f73..95f4c7d4187 100644 --- a/src/server/scripts/EasternKingdoms/MoltenCore/boss_baron_geddon.cpp +++ b/src/server/scripts/EasternKingdoms/MoltenCore/boss_baron_geddon.cpp @@ -31,79 +31,81 @@ EndScriptData */ #define SPELL_IGNITEMANA 19659 #define SPELL_LIVINGBOMB 20475 #define SPELL_ARMAGEDDOM 20479 - -struct boss_baron_geddonAI : public ScriptedAI +
class boss_baron_geddon : public CreatureScript { - boss_baron_geddonAI(Creature *c) : ScriptedAI(c) {} - - uint32 Inferno_Timer; - uint32 IgniteMana_Timer; - uint32 LivingBomb_Timer; +public: + boss_baron_geddon() : CreatureScript("boss_baron_geddon") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - Inferno_Timer = 45000; //These times are probably wrong - IgniteMana_Timer = 30000; - LivingBomb_Timer = 35000; + return new boss_baron_geddonAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_baron_geddonAI : public ScriptedAI { - } + boss_baron_geddonAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + uint32 Inferno_Timer; + uint32 IgniteMana_Timer; + uint32 LivingBomb_Timer; - //If we are <2% hp cast Armageddom - if (me->GetHealth()*100 / me->GetMaxHealth() <= 2) + void Reset() { - me->InterruptNonMeleeSpells(true); - DoCast(me, SPELL_ARMAGEDDOM); - DoScriptText(EMOTE_SERVICE, me); - return; + Inferno_Timer = 45000; //These times are probably wrong + IgniteMana_Timer = 30000; + LivingBomb_Timer = 35000; } - //Inferno_Timer - if (Inferno_Timer <= diff) - { - DoCast(me, SPELL_INFERNO); - Inferno_Timer = 45000; - } else Inferno_Timer -= diff; - - //IgniteMana_Timer - if (IgniteMana_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) - DoCast(pTarget, SPELL_IGNITEMANA); - - IgniteMana_Timer = 30000; - } else IgniteMana_Timer -= diff; + } - //LivingBomb_Timer - if (LivingBomb_Timer <= diff) + void UpdateAI(const uint32 diff) { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) - DoCast(pTarget, SPELL_LIVINGBOMB); - - LivingBomb_Timer = 35000; - } else LivingBomb_Timer -= diff; + if (!UpdateVictim()) + return; + + //If we are <2% hp cast Armageddom + if (me->GetHealth()*100 / me->GetMaxHealth() <= 2) + { + me->InterruptNonMeleeSpells(true); + DoCast(me, SPELL_ARMAGEDDOM); + DoScriptText(EMOTE_SERVICE, me); + return; + } + + //Inferno_Timer + if (Inferno_Timer <= diff) + { + DoCast(me, SPELL_INFERNO); + Inferno_Timer = 45000; + } else Inferno_Timer -= diff; + + //IgniteMana_Timer + if (IgniteMana_Timer <= diff) + { + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + DoCast(pTarget, SPELL_IGNITEMANA); + + IgniteMana_Timer = 30000; + } else IgniteMana_Timer -= diff; + + //LivingBomb_Timer + if (LivingBomb_Timer <= diff) + { + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + DoCast(pTarget, SPELL_LIVINGBOMB); + + LivingBomb_Timer = 35000; + } else LivingBomb_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_baron_geddon(Creature* pCreature) -{ - return new boss_baron_geddonAI (pCreature); -} void AddSC_boss_baron_geddon() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_baron_geddon"; - newscript->GetAI = &GetAI_boss_baron_geddon; - newscript->RegisterSelf(); + new boss_baron_geddon(); } - diff --git a/src/server/scripts/EasternKingdoms/MoltenCore/boss_garr.cpp b/src/server/scripts/EasternKingdoms/MoltenCore/boss_garr.cpp index 18eef567088..39c1a5aa031 100644 --- a/src/server/scripts/EasternKingdoms/MoltenCore/boss_garr.cpp +++ b/src/server/scripts/EasternKingdoms/MoltenCore/boss_garr.cpp @@ -33,113 +33,117 @@ EndScriptData */ //Add spells #define SPELL_ERUPTION 19497 #define SPELL_IMMOLATE 20294 - -struct boss_garrAI : public ScriptedAI +
class boss_garr : public CreatureScript { - boss_garrAI(Creature *c) : ScriptedAI(c) {} - - uint32 AntiMagicPulse_Timer; - uint32 MagmaShackles_Timer; - uint32 CheckAdds_Timer; - uint64 Add[8]; - bool Enraged[8]; +public: + boss_garr() : CreatureScript("boss_garr") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - AntiMagicPulse_Timer = 25000; //These times are probably wrong - MagmaShackles_Timer = 15000; - CheckAdds_Timer = 2000; + return new boss_garrAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_garrAI : public ScriptedAI { - } + boss_garrAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + uint32 AntiMagicPulse_Timer; + uint32 MagmaShackles_Timer; + uint32 CheckAdds_Timer; + uint64 Add[8]; + bool Enraged[8]; - //AntiMagicPulse_Timer - if (AntiMagicPulse_Timer <= diff) + void Reset() { - DoCast(me, SPELL_ANTIMAGICPULSE); - AntiMagicPulse_Timer = 10000 + rand()%5000; - } else AntiMagicPulse_Timer -= diff; + AntiMagicPulse_Timer = 25000; //These times are probably wrong + MagmaShackles_Timer = 15000; + CheckAdds_Timer = 2000; + } - //MagmaShackles_Timer - if (MagmaShackles_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - DoCast(me, SPELL_MAGMASHACKLES); - MagmaShackles_Timer = 8000 + rand()%4000; - } else MagmaShackles_Timer -= diff; + } - DoMeleeAttackIfReady(); - } -}; + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + //AntiMagicPulse_Timer + if (AntiMagicPulse_Timer <= diff) + { + DoCast(me, SPELL_ANTIMAGICPULSE); + AntiMagicPulse_Timer = 10000 + rand()%5000; + } else AntiMagicPulse_Timer -= diff; + + //MagmaShackles_Timer + if (MagmaShackles_Timer <= diff) + { + DoCast(me, SPELL_MAGMASHACKLES); + MagmaShackles_Timer = 8000 + rand()%4000; + } else MagmaShackles_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; -struct mob_fireswornAI : public ScriptedAI +}; +
class mob_firesworn : public CreatureScript { - mob_fireswornAI(Creature *c) : ScriptedAI(c) {} - - uint32 Immolate_Timer; +public: + mob_firesworn() : CreatureScript("mob_firesworn") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - Immolate_Timer = 4000; //These times are probably wrong + return new mob_fireswornAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct mob_fireswornAI : public ScriptedAI { - } + mob_fireswornAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + uint32 Immolate_Timer; - //Immolate_Timer - if (Immolate_Timer <= diff) + void Reset() { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) - DoCast(pTarget, SPELL_IMMOLATE); + Immolate_Timer = 4000; //These times are probably wrong + } - Immolate_Timer = urand(5000,10000); - } else Immolate_Timer -= diff; + void EnterCombat(Unit * /*who*/) + { + } - //Cast Erruption and let them die - if (me->GetHealth() <= me->GetMaxHealth() * 0.10) + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_ERUPTION); - me->setDeathState(JUST_DIED); - me->RemoveCorpse(); + if (!UpdateVictim()) + return; + + //Immolate_Timer + if (Immolate_Timer <= diff) + { + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + DoCast(pTarget, SPELL_IMMOLATE); + + Immolate_Timer = urand(5000,10000); + } else Immolate_Timer -= diff; + + //Cast Erruption and let them die + if (me->GetHealth() <= me->GetMaxHealth() * 0.10) + { + DoCast(me->getVictim(), SPELL_ERUPTION); + me->setDeathState(JUST_DIED); + me->RemoveCorpse(); + } + + DoMeleeAttackIfReady(); } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_garr(Creature* pCreature) -{ - return new boss_garrAI (pCreature); -} -CreatureAI* GetAI_mob_firesworn(Creature* pCreature) -{ - return new mob_fireswornAI (pCreature); -} void AddSC_boss_garr() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_garr"; - newscript->GetAI = &GetAI_boss_garr; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_firesworn"; - newscript->GetAI = &GetAI_mob_firesworn; - newscript->RegisterSelf(); + new boss_garr(); + new mob_firesworn(); } - diff --git a/src/server/scripts/EasternKingdoms/MoltenCore/boss_gehennas.cpp b/src/server/scripts/EasternKingdoms/MoltenCore/boss_gehennas.cpp index a2e3550b87b..07c1eb1f2d3 100644 --- a/src/server/scripts/EasternKingdoms/MoltenCore/boss_gehennas.cpp +++ b/src/server/scripts/EasternKingdoms/MoltenCore/boss_gehennas.cpp @@ -28,68 +28,70 @@ EndScriptData */ #define SPELL_SHADOWBOLT 19728 #define SPELL_RAINOFFIRE 19717 #define SPELL_GEHENNASCURSE 19716 - -struct boss_gehennasAI : public ScriptedAI +
class boss_gehennas : public CreatureScript { - boss_gehennasAI(Creature *c) : ScriptedAI(c) {} - - uint32 ShadowBolt_Timer; - uint32 RainOfFire_Timer; - uint32 GehennasCurse_Timer; +public: + boss_gehennas() : CreatureScript("boss_gehennas") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - ShadowBolt_Timer = 6000; - RainOfFire_Timer = 10000; - GehennasCurse_Timer = 12000; + return new boss_gehennasAI (pCreature); } - void EnterCombat(Unit * /*who*/) {} - - void UpdateAI(const uint32 diff) + struct boss_gehennasAI : public ScriptedAI { - if (!UpdateVictim()) - return; - - //ShadowBolt_Timer - if (ShadowBolt_Timer <= diff) - { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 1)) - DoCast(pTarget, SPELL_SHADOWBOLT); + boss_gehennasAI(Creature *c) : ScriptedAI(c) {} - ShadowBolt_Timer = 7000; - } else ShadowBolt_Timer -= diff; + uint32 ShadowBolt_Timer; + uint32 RainOfFire_Timer; + uint32 GehennasCurse_Timer; - //RainOfFire_Timer - if (RainOfFire_Timer <= diff) + void Reset() { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget, SPELL_RAINOFFIRE); + ShadowBolt_Timer = 6000; + RainOfFire_Timer = 10000; + GehennasCurse_Timer = 12000; + } - RainOfFire_Timer = urand(4000,12000); - } else RainOfFire_Timer -= diff; + void EnterCombat(Unit * /*who*/) {} - //GehennasCurse_Timer - if (GehennasCurse_Timer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_GEHENNASCURSE); - GehennasCurse_Timer = urand(22000,30000); - } else GehennasCurse_Timer -= diff; + if (!UpdateVictim()) + return; + + //ShadowBolt_Timer + if (ShadowBolt_Timer <= diff) + { + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 1)) + DoCast(pTarget, SPELL_SHADOWBOLT); + + ShadowBolt_Timer = 7000; + } else ShadowBolt_Timer -= diff; + + //RainOfFire_Timer + if (RainOfFire_Timer <= diff) + { + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, SPELL_RAINOFFIRE); + + RainOfFire_Timer = urand(4000,12000); + } else RainOfFire_Timer -= diff; + + //GehennasCurse_Timer + if (GehennasCurse_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_GEHENNASCURSE); + GehennasCurse_Timer = urand(22000,30000); + } else GehennasCurse_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_gehennas(Creature* pCreature) -{ - return new boss_gehennasAI (pCreature); -} void AddSC_boss_gehennas() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_gehennas"; - newscript->GetAI = &GetAI_boss_gehennas; - newscript->RegisterSelf(); + new boss_gehennas(); } - diff --git a/src/server/scripts/EasternKingdoms/MoltenCore/boss_golemagg.cpp b/src/server/scripts/EasternKingdoms/MoltenCore/boss_golemagg.cpp index 5ad9768d567..b9739f93b6c 100644 --- a/src/server/scripts/EasternKingdoms/MoltenCore/boss_golemagg.cpp +++ b/src/server/scripts/EasternKingdoms/MoltenCore/boss_golemagg.cpp @@ -38,163 +38,167 @@ enum eEnums EMOTE_LOWHP = -1409002, SPELL_MANGLE = 19820 }; - -struct boss_golemaggAI : public ScriptedAI +
class boss_golemagg : public CreatureScript { - boss_golemaggAI(Creature* pCreature) : ScriptedAI(pCreature) - { - m_pInstance = pCreature->GetInstanceData(); - } - - ScriptedInstance* m_pInstance; +public: + boss_golemagg() : CreatureScript("boss_golemagg") { } - uint32 m_uiPyroblastTimer; - uint32 m_uiEarthquakeTimer; - uint32 m_uiBuffTimer; - bool m_bEnraged; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - m_uiPyroblastTimer = 7*IN_MILLISECONDS; // These timers are probably wrong - m_uiEarthquakeTimer = 3*IN_MILLISECONDS; - m_uiBuffTimer = 2.5*IN_MILLISECONDS; - m_bEnraged = false; - - DoCast(me, SPELL_MAGMASPLASH, true); + return new boss_golemaggAI (pCreature); } - void JustDied(Unit* /*pKiller*/) + struct boss_golemaggAI : public ScriptedAI { - if (m_pInstance) - m_pInstance->SetData(DATA_GOLEMAGG_DEATH, 0); - } + boss_golemaggAI(Creature* pCreature) : ScriptedAI(pCreature) + { + m_pInstance = pCreature->GetInstanceScript(); + } - void UpdateAI(const uint32 uiDiff) - { - if (!UpdateVictim()) - return; + InstanceScript* m_pInstance; - //Pyroblast - if (m_uiPyroblastTimer <= uiDiff) + uint32 m_uiPyroblastTimer; + uint32 m_uiEarthquakeTimer; + uint32 m_uiBuffTimer; + bool m_bEnraged; + + void Reset() { - if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget, SPELL_PYROBLAST); + m_uiPyroblastTimer = 7*IN_MILLISECONDS; // These timers are probably wrong + m_uiEarthquakeTimer = 3*IN_MILLISECONDS; + m_uiBuffTimer = 2.5*IN_MILLISECONDS; + m_bEnraged = false; - m_uiPyroblastTimer = 7*IN_MILLISECONDS; + DoCast(me, SPELL_MAGMASPLASH, true); } - else - m_uiPyroblastTimer -= uiDiff; - // Enrage - if (!m_bEnraged && me->GetHealth()*100 < me->GetMaxHealth()*10) + void JustDied(Unit* /*pKiller*/) { - DoCast(me, SPELL_ENRAGE); - m_bEnraged = true; + if (m_pInstance) + m_pInstance->SetData(DATA_GOLEMAGG_DEATH, 0); } - // Earthquake - if (m_bEnraged) + void UpdateAI(const uint32 uiDiff) { - if (m_uiEarthquakeTimer <= uiDiff) + if (!UpdateVictim()) + return; + + //Pyroblast + if (m_uiPyroblastTimer <= uiDiff) + { + if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, SPELL_PYROBLAST); + + m_uiPyroblastTimer = 7*IN_MILLISECONDS; + } + else + m_uiPyroblastTimer -= uiDiff; + + // Enrage + if (!m_bEnraged && me->GetHealth()*100 < me->GetMaxHealth()*10) { - DoCast(me->getVictim(), SPELL_EARTHQUAKE); - m_uiEarthquakeTimer = 3*IN_MILLISECONDS; + DoCast(me, SPELL_ENRAGE); + m_bEnraged = true; + } + + // Earthquake + if (m_bEnraged) + { + if (m_uiEarthquakeTimer <= uiDiff) + { + DoCast(me->getVictim(), SPELL_EARTHQUAKE); + m_uiEarthquakeTimer = 3*IN_MILLISECONDS; + } + else + m_uiEarthquakeTimer -= uiDiff; + } + + /* + // Golemagg's Trust + if (m_uiBuffTimer <= uidiff) + { + DoCast(me, SPELL_GOLEMAGG_TRUST); + m_uiBuffTimer = 2.5*IN_MILLISECONDS; } else - m_uiEarthquakeTimer -= uiDiff; - } + m_uiBuffTimer -= uiDiff; + */ - /* - // Golemagg's Trust - if (m_uiBuffTimer <= uidiff) - { - DoCast(me, SPELL_GOLEMAGG_TRUST); - m_uiBuffTimer = 2.5*IN_MILLISECONDS; + DoMeleeAttackIfReady(); } - else - m_uiBuffTimer -= uiDiff; - */ + }; - DoMeleeAttackIfReady(); - } }; - -struct mob_core_ragerAI : public ScriptedAI +
class mob_core_rager : public CreatureScript { - mob_core_ragerAI(Creature *c) : ScriptedAI(c) +public: + mob_core_rager() : CreatureScript("mob_core_rager") { } + + CreatureAI* GetAI(Creature* pCreature) const { - m_pInstance = c->GetInstanceData(); + return new mob_core_ragerAI (pCreature); } - ScriptedInstance* m_pInstance; + struct mob_core_ragerAI : public ScriptedAI + { + mob_core_ragerAI(Creature *c) : ScriptedAI(c) + { + m_pInstance = c->GetInstanceScript(); + } - uint32 m_uiMangleTimer; + InstanceScript* m_pInstance; - void Reset() - { - m_uiMangleTimer = 7*IN_MILLISECONDS; // These times are probably wrong - } + uint32 m_uiMangleTimer; - void DamageTaken(Unit* /*pDoneBy*/, uint32& uiDamage) - { - if (me->GetHealth()*100 < me->GetMaxHealth()*50) + void Reset() { - if (m_pInstance) + m_uiMangleTimer = 7*IN_MILLISECONDS; // These times are probably wrong + } + + void DamageTaken(Unit* /*pDoneBy*/, uint32& uiDamage) + { + if (me->GetHealth()*100 < me->GetMaxHealth()*50) { - if (Creature* pGolemagg = m_pInstance->instance->GetCreature(m_pInstance->GetData64(DATA_GOLEMAGG))) + if (m_pInstance) { - if (pGolemagg->isAlive()) + if (Creature* pGolemagg = m_pInstance->instance->GetCreature(m_pInstance->GetData64(DATA_GOLEMAGG))) { - DoScriptText(EMOTE_LOWHP, me); - me->SetHealth(me->GetMaxHealth()); + if (pGolemagg->isAlive()) + { + DoScriptText(EMOTE_LOWHP, me); + me->SetHealth(me->GetMaxHealth()); + } + else + uiDamage = me->GetHealth(); } - else - uiDamage = me->GetHealth(); } } } - } - void UpdateAI(const uint32 uiDiff) - { - if (!UpdateVictim()) - return; - - // Mangle - if (m_uiMangleTimer <= uiDiff) + void UpdateAI(const uint32 uiDiff) { - DoCast(me->getVictim(), SPELL_MANGLE); - m_uiMangleTimer = 10*IN_MILLISECONDS; + if (!UpdateVictim()) + return; + + // Mangle + if (m_uiMangleTimer <= uiDiff) + { + DoCast(me->getVictim(), SPELL_MANGLE); + m_uiMangleTimer = 10*IN_MILLISECONDS; + } + else + m_uiMangleTimer -= uiDiff; + + DoMeleeAttackIfReady(); } - else - m_uiMangleTimer -= uiDiff; + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_golemagg(Creature* pCreature) -{ - return new boss_golemaggAI (pCreature); -} -CreatureAI* GetAI_mob_core_rager(Creature* pCreature) -{ - return new mob_core_ragerAI (pCreature); -} void AddSC_boss_golemagg() { - Script* newscript; - - newscript = new Script; - newscript->Name = "boss_golemagg"; - newscript->GetAI = &GetAI_boss_golemagg; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_core_rager"; - newscript->GetAI = &GetAI_mob_core_rager; - newscript->RegisterSelf(); + new boss_golemagg(); + new mob_core_rager(); } - diff --git a/src/server/scripts/EasternKingdoms/MoltenCore/boss_lucifron.cpp b/src/server/scripts/EasternKingdoms/MoltenCore/boss_lucifron.cpp index 761bfa97f81..45b15c7bebf 100644 --- a/src/server/scripts/EasternKingdoms/MoltenCore/boss_lucifron.cpp +++ b/src/server/scripts/EasternKingdoms/MoltenCore/boss_lucifron.cpp @@ -28,66 +28,68 @@ EndScriptData */ #define SPELL_IMPENDINGDOOM 19702 #define SPELL_LUCIFRONCURSE 19703 #define SPELL_SHADOWSHOCK 20603 - -struct boss_lucifronAI : public ScriptedAI +
class boss_lucifron : public CreatureScript { - boss_lucifronAI(Creature *c) : ScriptedAI(c) {} - - uint32 ImpendingDoom_Timer; - uint32 LucifronCurse_Timer; - uint32 ShadowShock_Timer; +public: + boss_lucifron() : CreatureScript("boss_lucifron") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - ImpendingDoom_Timer = 10000; //Initial cast after 10 seconds so the debuffs alternate - LucifronCurse_Timer = 20000; //Initial cast after 20 seconds - ShadowShock_Timer = 6000; //6 seconds + return new boss_lucifronAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_lucifronAI : public ScriptedAI { - } + boss_lucifronAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + uint32 ImpendingDoom_Timer; + uint32 LucifronCurse_Timer; + uint32 ShadowShock_Timer; - //Impending doom timer - if (ImpendingDoom_Timer <= diff) + void Reset() { - DoCast(me->getVictim(), SPELL_IMPENDINGDOOM); - ImpendingDoom_Timer = 20000; - } else ImpendingDoom_Timer -= diff; + ImpendingDoom_Timer = 10000; //Initial cast after 10 seconds so the debuffs alternate + LucifronCurse_Timer = 20000; //Initial cast after 20 seconds + ShadowShock_Timer = 6000; //6 seconds + } - //Lucifron's curse timer - if (LucifronCurse_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - DoCast(me->getVictim(), SPELL_LUCIFRONCURSE); - LucifronCurse_Timer = 15000; - } else LucifronCurse_Timer -= diff; + } - //Shadowshock - if (ShadowShock_Timer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_SHADOWSHOCK); - ShadowShock_Timer = 6000; - } else ShadowShock_Timer -= diff; + if (!UpdateVictim()) + return; + + //Impending doom timer + if (ImpendingDoom_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_IMPENDINGDOOM); + ImpendingDoom_Timer = 20000; + } else ImpendingDoom_Timer -= diff; + + //Lucifron's curse timer + if (LucifronCurse_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_LUCIFRONCURSE); + LucifronCurse_Timer = 15000; + } else LucifronCurse_Timer -= diff; + + //Shadowshock + if (ShadowShock_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_SHADOWSHOCK); + ShadowShock_Timer = 6000; + } else ShadowShock_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_lucifron(Creature* pCreature) -{ - return new boss_lucifronAI (pCreature); -} void AddSC_boss_lucifron() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_lucifron"; - newscript->GetAI = &GetAI_boss_lucifron; - newscript->RegisterSelf(); + new boss_lucifron(); } - diff --git a/src/server/scripts/EasternKingdoms/MoltenCore/boss_magmadar.cpp b/src/server/scripts/EasternKingdoms/MoltenCore/boss_magmadar.cpp index fd64e42fed1..785ee11066c 100644 --- a/src/server/scripts/EasternKingdoms/MoltenCore/boss_magmadar.cpp +++ b/src/server/scripts/EasternKingdoms/MoltenCore/boss_magmadar.cpp @@ -32,71 +32,73 @@ EndScriptData */ #define SPELL_PANIC 19408 #define SPELL_LAVABOMB 19411 //This calls a dummy server side effect that isn't implemented yet #define SPELL_LAVABOMB_ALT 19428 //This is the spell that the lava bomb casts - -struct boss_magmadarAI : public ScriptedAI +
class boss_magmadar : public CreatureScript { - boss_magmadarAI(Creature *c) : ScriptedAI(c) {} - - uint32 Frenzy_Timer; - uint32 Panic_Timer; - uint32 Lavabomb_Timer; +public: + boss_magmadar() : CreatureScript("boss_magmadar") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - Frenzy_Timer = 30000; - Panic_Timer = 20000; - Lavabomb_Timer = 12000; - - DoCast(me, SPELL_MAGMASPIT, true); + return new boss_magmadarAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_magmadarAI : public ScriptedAI { - } + boss_magmadarAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + uint32 Frenzy_Timer; + uint32 Panic_Timer; + uint32 Lavabomb_Timer; - //Frenzy_Timer - if (Frenzy_Timer <= diff) + void Reset() { - DoScriptText(EMOTE_FRENZY, me); - DoCast(me, SPELL_FRENZY); - Frenzy_Timer = 15000; - } else Frenzy_Timer -= diff; + Frenzy_Timer = 30000; + Panic_Timer = 20000; + Lavabomb_Timer = 12000; - //Panic_Timer - if (Panic_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_PANIC); - Panic_Timer = 35000; - } else Panic_Timer -= diff; + DoCast(me, SPELL_MAGMASPIT, true); + } - //Lavabomb_Timer - if (Lavabomb_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) - DoCast(pTarget, SPELL_LAVABOMB_ALT); + } - Lavabomb_Timer = 12000; - } else Lavabomb_Timer -= diff; + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + //Frenzy_Timer + if (Frenzy_Timer <= diff) + { + DoScriptText(EMOTE_FRENZY, me); + DoCast(me, SPELL_FRENZY); + Frenzy_Timer = 15000; + } else Frenzy_Timer -= diff; + + //Panic_Timer + if (Panic_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_PANIC); + Panic_Timer = 35000; + } else Panic_Timer -= diff; + + //Lavabomb_Timer + if (Lavabomb_Timer <= diff) + { + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + DoCast(pTarget, SPELL_LAVABOMB_ALT); + + Lavabomb_Timer = 12000; + } else Lavabomb_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_magmadar(Creature* pCreature) -{ - return new boss_magmadarAI (pCreature); -} void AddSC_boss_magmadar() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_magmadar"; - newscript->GetAI = &GetAI_boss_magmadar; - newscript->RegisterSelf(); + new boss_magmadar(); } - diff --git a/src/server/scripts/EasternKingdoms/MoltenCore/boss_majordomo_executus.cpp b/src/server/scripts/EasternKingdoms/MoltenCore/boss_majordomo_executus.cpp index 3b8bf20256d..4b4f2f5c784 100644 --- a/src/server/scripts/EasternKingdoms/MoltenCore/boss_majordomo_executus.cpp +++ b/src/server/scripts/EasternKingdoms/MoltenCore/boss_majordomo_executus.cpp @@ -52,85 +52,87 @@ EndScriptData */ #define ENTRY_FLAMEWALKER_HEALER 11663 #define ENTRY_FLAMEWALKER_ELITE 11664 - -struct boss_majordomoAI : public ScriptedAI +
class boss_majordomo : public CreatureScript { - boss_majordomoAI(Creature *c) : ScriptedAI(c) {} - - uint32 MagicReflection_Timer; - uint32 DamageReflection_Timer; - uint32 Blastwave_Timer; - - void Reset() - { - MagicReflection_Timer = 30000; //Damage reflection first so we alternate - DamageReflection_Timer = 15000; - Blastwave_Timer = 10000; - } +public: + boss_majordomo() : CreatureScript("boss_majordomo") { } - void KilledUnit(Unit* /*victim*/) + CreatureAI* GetAI(Creature* pCreature) const { - if (rand()%5) - return; - - DoScriptText(SAY_SLAY, me); + return new boss_majordomoAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_majordomoAI : public ScriptedAI { - DoScriptText(SAY_AGGRO, me); - } + boss_majordomoAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + uint32 MagicReflection_Timer; + uint32 DamageReflection_Timer; + uint32 Blastwave_Timer; - //Cast Ageis if less than 50% hp - if (me->GetHealth()*100 / me->GetMaxHealth() < 50) + void Reset() { - DoCast(me, SPELL_AEGIS); + MagicReflection_Timer = 30000; //Damage reflection first so we alternate + DamageReflection_Timer = 15000; + Blastwave_Timer = 10000; } - //MagicReflection_Timer - // if (MagicReflection_Timer <= diff) - // { - // DoCast(me, SPELL_MAGICREFLECTION); - - //60 seconds until we should cast this agian - // MagicReflection_Timer = 30000; - // } else MagicReflection_Timer -= diff; + void KilledUnit(Unit* /*victim*/) + { + if (rand()%5) + return; - //DamageReflection_Timer - // if (DamageReflection_Timer <= diff) - // { - // DoCast(me, SPELL_DAMAGEREFLECTION); + DoScriptText(SAY_SLAY, me); + } - //60 seconds until we should cast this agian - // DamageReflection_Timer = 30000; - // } else DamageReflection_Timer -= diff; + void EnterCombat(Unit * /*who*/) + { + DoScriptText(SAY_AGGRO, me); + } - //Blastwave_Timer - if (Blastwave_Timer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_BLASTWAVE); - Blastwave_Timer = 10000; - } else Blastwave_Timer -= diff; + if (!UpdateVictim()) + return; + + //Cast Ageis if less than 50% hp + if (me->GetHealth()*100 / me->GetMaxHealth() < 50) + { + DoCast(me, SPELL_AEGIS); + } + + //MagicReflection_Timer + // if (MagicReflection_Timer <= diff) + // { + // DoCast(me, SPELL_MAGICREFLECTION); + + //60 seconds until we should cast this agian + // MagicReflection_Timer = 30000; + // } else MagicReflection_Timer -= diff; + + //DamageReflection_Timer + // if (DamageReflection_Timer <= diff) + // { + // DoCast(me, SPELL_DAMAGEREFLECTION); + + //60 seconds until we should cast this agian + // DamageReflection_Timer = 30000; + // } else DamageReflection_Timer -= diff; + + //Blastwave_Timer + if (Blastwave_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_BLASTWAVE); + Blastwave_Timer = 10000; + } else Blastwave_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_majordomo(Creature* pCreature) -{ - return new boss_majordomoAI (pCreature); -} void AddSC_boss_majordomo() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_majordomo"; - newscript->GetAI = &GetAI_boss_majordomo; - newscript->RegisterSelf(); + new boss_majordomo(); } - diff --git a/src/server/scripts/EasternKingdoms/MoltenCore/boss_ragnaros.cpp b/src/server/scripts/EasternKingdoms/MoltenCore/boss_ragnaros.cpp index fc7f9948f0a..7fc099546ed 100644 --- a/src/server/scripts/EasternKingdoms/MoltenCore/boss_ragnaros.cpp +++ b/src/server/scripts/EasternKingdoms/MoltenCore/boss_ragnaros.cpp @@ -84,216 +84,218 @@ EndScriptData */ #define ADD_8Y -810.869385 #define ADD_8Z -229.683182 #define ADD_8O 4.693108 - -struct boss_ragnarosAI : public ScriptedAI +
class boss_ragnaros : public CreatureScript { - boss_ragnarosAI(Creature *c) : ScriptedAI(c) - { - SetCombatMovement(false); - } +public: + boss_ragnaros() : CreatureScript("boss_ragnaros") { } - uint32 WrathOfRagnaros_Timer; - uint32 HandOfRagnaros_Timer; - uint32 LavaBurst_Timer; - uint32 MagmaBurst_Timer; - uint32 ElementalFire_Timer; - uint32 Erruption_Timer; - uint32 Submerge_Timer; - uint32 Attack_Timer; - - bool HasYelledMagmaBurst; - bool HasSubmergedOnce; - bool WasBanished; - bool HasAura; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - WrathOfRagnaros_Timer = 30000; - HandOfRagnaros_Timer = 25000; - LavaBurst_Timer = 10000; - MagmaBurst_Timer = 2000; - Erruption_Timer = 15000; - ElementalFire_Timer = 3000; - Submerge_Timer = 180000; - Attack_Timer = 90000; - HasYelledMagmaBurst = false; - HasSubmergedOnce = false; - WasBanished = false; - - DoCast(me, SPELL_MELTWEAPON, true); - HasAura = true; + return new boss_ragnarosAI (pCreature); } - void KilledUnit(Unit* /*victim*/) + struct boss_ragnarosAI : public ScriptedAI { - if (rand()%5) - return; - - DoScriptText(SAY_KILL, me); - } - - void EnterCombat(Unit * /*who*/) - { - } + boss_ragnarosAI(Creature *c) : ScriptedAI(c) + { + SetCombatMovement(false); + } - void UpdateAI(const uint32 diff) - { - if (WasBanished && Attack_Timer <= diff) + uint32 WrathOfRagnaros_Timer; + uint32 HandOfRagnaros_Timer; + uint32 LavaBurst_Timer; + uint32 MagmaBurst_Timer; + uint32 ElementalFire_Timer; + uint32 Erruption_Timer; + uint32 Submerge_Timer; + uint32 Attack_Timer; + + bool HasYelledMagmaBurst; + bool HasSubmergedOnce; + bool WasBanished; + bool HasAura; + + void Reset() { - //Become unbanished again - me->setFaction(14); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - DoCast(me, SPELL_RAGEMERGE); + WrathOfRagnaros_Timer = 30000; + HandOfRagnaros_Timer = 25000; + LavaBurst_Timer = 10000; + MagmaBurst_Timer = 2000; + Erruption_Timer = 15000; + ElementalFire_Timer = 3000; + Submerge_Timer = 180000; + Attack_Timer = 90000; + HasYelledMagmaBurst = false; + HasSubmergedOnce = false; WasBanished = false; - } else if (WasBanished) + + DoCast(me, SPELL_MELTWEAPON, true); + HasAura = true; + } + + void KilledUnit(Unit* /*victim*/) { - Attack_Timer -= diff; - //Do nothing while banished - return; + if (rand()%5) + return; + + DoScriptText(SAY_KILL, me); } - //Return since we have no target - if (!UpdateVictim()) - return; + void EnterCombat(Unit * /*who*/) + { + } - //WrathOfRagnaros_Timer - if (WrathOfRagnaros_Timer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_WRATHOFRAGNAROS); + if (WasBanished && Attack_Timer <= diff) + { + //Become unbanished again + me->setFaction(14); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + DoCast(me, SPELL_RAGEMERGE); + WasBanished = false; + } else if (WasBanished) + { + Attack_Timer -= diff; + //Do nothing while banished + return; + } - if (urand(0,1)) - DoScriptText(SAY_WRATH, me); + //Return since we have no target + if (!UpdateVictim()) + return; - WrathOfRagnaros_Timer = 30000; - } else WrathOfRagnaros_Timer -= diff; + //WrathOfRagnaros_Timer + if (WrathOfRagnaros_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_WRATHOFRAGNAROS); - //HandOfRagnaros_Timer - if (HandOfRagnaros_Timer <= diff) - { - DoCast(me, SPELL_HANDOFRAGNAROS); + if (urand(0,1)) + DoScriptText(SAY_WRATH, me); - if (urand(0,1)) - DoScriptText(SAY_HAND, me); + WrathOfRagnaros_Timer = 30000; + } else WrathOfRagnaros_Timer -= diff; - HandOfRagnaros_Timer = 25000; - } else HandOfRagnaros_Timer -= diff; + //HandOfRagnaros_Timer + if (HandOfRagnaros_Timer <= diff) + { + DoCast(me, SPELL_HANDOFRAGNAROS); - //LavaBurst_Timer - if (LavaBurst_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_LAVABURST); - LavaBurst_Timer = 10000; - } else LavaBurst_Timer -= diff; + if (urand(0,1)) + DoScriptText(SAY_HAND, me); - //Erruption_Timer - if (LavaBurst_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_ERRUPTION); - Erruption_Timer = urand(20000,45000); - } else Erruption_Timer -= diff; + HandOfRagnaros_Timer = 25000; + } else HandOfRagnaros_Timer -= diff; - //ElementalFire_Timer - if (ElementalFire_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_ELEMENTALFIRE); - ElementalFire_Timer = urand(10000,14000); - } else ElementalFire_Timer -= diff; + //LavaBurst_Timer + if (LavaBurst_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_LAVABURST); + LavaBurst_Timer = 10000; + } else LavaBurst_Timer -= diff; - //Submerge_Timer - if (!WasBanished && Submerge_Timer <= diff) - { - //Creature spawning and ragnaros becomming unattackable - //is not very well supported in the core - //so added normaly spawning and banish workaround and attack again after 90 secs. - - me->InterruptNonMeleeSpells(false); - //Root self - DoCast(me, 23973); - me->setFaction(35); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->HandleEmoteCommand(EMOTE_ONESHOT_SUBMERGE); - - if (!HasSubmergedOnce) + //Erruption_Timer + if (LavaBurst_Timer <= diff) { - DoScriptText(SAY_REINFORCEMENTS1, me); + DoCast(me->getVictim(), SPELL_ERRUPTION); + Erruption_Timer = urand(20000,45000); + } else Erruption_Timer -= diff; - // summon 10 elementals - for (uint8 i = 0; i < 9; ++i) + //ElementalFire_Timer + if (ElementalFire_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_ELEMENTALFIRE); + ElementalFire_Timer = urand(10000,14000); + } else ElementalFire_Timer -= diff; + + //Submerge_Timer + if (!WasBanished && Submerge_Timer <= diff) + { + //Creature spawning and ragnaros becomming unattackable + //is not very well supported in the core + //so added normaly spawning and banish workaround and attack again after 90 secs. + + me->InterruptNonMeleeSpells(false); + //Root self + DoCast(me, 23973); + me->setFaction(35); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->HandleEmoteCommand(EMOTE_ONESHOT_SUBMERGE); + + if (!HasSubmergedOnce) { - if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + DoScriptText(SAY_REINFORCEMENTS1, me); + + // summon 10 elementals + for (uint8 i = 0; i < 9; ++i) { - if (Creature* pSummoned = me->SummonCreature(12143,pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ(),0.0f,TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN,900000)) - pSummoned->AI()->AttackStart(pTarget); + if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + { + if (Creature* pSummoned = me->SummonCreature(12143,pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ(),0.0f,TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN,900000)) + pSummoned->AI()->AttackStart(pTarget); + } } - } - HasSubmergedOnce = true; - WasBanished = true; - DoCast(me, SPELL_RAGSUBMERGE); - Attack_Timer = 90000; + HasSubmergedOnce = true; + WasBanished = true; + DoCast(me, SPELL_RAGSUBMERGE); + Attack_Timer = 90000; - } - else - { - DoScriptText(SAY_REINFORCEMENTS2, me); - - for (uint8 i = 0; i < 9; ++i) + } + else { - if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + DoScriptText(SAY_REINFORCEMENTS2, me); + + for (uint8 i = 0; i < 9; ++i) { - if (Creature* pSummoned = me->SummonCreature(12143,pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ(),0.0f,TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN,900000)) - pSummoned->AI()->AttackStart(pTarget); + if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + { + if (Creature* pSummoned = me->SummonCreature(12143,pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ(),0.0f,TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN,900000)) + pSummoned->AI()->AttackStart(pTarget); + } } - } - WasBanished = true; - DoCast(me, SPELL_RAGSUBMERGE); - Attack_Timer = 90000; - } + WasBanished = true; + DoCast(me, SPELL_RAGSUBMERGE); + Attack_Timer = 90000; + } - Submerge_Timer = 180000; - } else Submerge_Timer -= diff; + Submerge_Timer = 180000; + } else Submerge_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)) + //If we are within range melee the target + if (me->IsWithinMeleeRange(me->getVictim())) { - me->AttackerStateUpdate(me->getVictim()); - me->resetAttackTimer(); + //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 - { - //MagmaBurst_Timer - if (MagmaBurst_Timer <= diff) + else { - DoCast(me->getVictim(), SPELL_MAGMABURST); - - if (!HasYelledMagmaBurst) + //MagmaBurst_Timer + if (MagmaBurst_Timer <= diff) { - //Say our dialog - DoScriptText(SAY_MAGMABURST, me); - HasYelledMagmaBurst = true; - } + DoCast(me->getVictim(), SPELL_MAGMABURST); - MagmaBurst_Timer = 2500; - } else MagmaBurst_Timer -= diff; + if (!HasYelledMagmaBurst) + { + //Say our dialog + DoScriptText(SAY_MAGMABURST, me); + HasYelledMagmaBurst = true; + } + + MagmaBurst_Timer = 2500; + } else MagmaBurst_Timer -= diff; + } } - } + }; + }; -CreatureAI* GetAI_boss_ragnaros(Creature* pCreature) -{ - return new boss_ragnarosAI (pCreature); -} void AddSC_boss_ragnaros() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_ragnaros"; - newscript->GetAI = &GetAI_boss_ragnaros; - newscript->RegisterSelf(); + new boss_ragnaros(); } - diff --git a/src/server/scripts/EasternKingdoms/MoltenCore/boss_shazzrah.cpp b/src/server/scripts/EasternKingdoms/MoltenCore/boss_shazzrah.cpp index f2b6b4a99f8..4086935e7ae 100644 --- a/src/server/scripts/EasternKingdoms/MoltenCore/boss_shazzrah.cpp +++ b/src/server/scripts/EasternKingdoms/MoltenCore/boss_shazzrah.cpp @@ -29,95 +29,97 @@ EndScriptData */ #define SPELL_SHAZZRAHCURSE 19713 #define SPELL_DEADENMAGIC 19714 #define SPELL_COUNTERSPELL 19715 - -struct boss_shazzrahAI : public ScriptedAI +
class boss_shazzrah : public CreatureScript { - boss_shazzrahAI(Creature *c) : ScriptedAI(c) {} - - uint32 ArcaneExplosion_Timer; - uint32 ShazzrahCurse_Timer; - uint32 DeadenMagic_Timer; - uint32 Countspell_Timer; - uint32 Blink_Timer; +public: + boss_shazzrah() : CreatureScript("boss_shazzrah") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - ArcaneExplosion_Timer = 6000; //These times are probably wrong - ShazzrahCurse_Timer = 10000; - DeadenMagic_Timer = 24000; - Countspell_Timer = 15000; - Blink_Timer = 30000; + return new boss_shazzrahAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_shazzrahAI : public ScriptedAI { - } + boss_shazzrahAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + uint32 ArcaneExplosion_Timer; + uint32 ShazzrahCurse_Timer; + uint32 DeadenMagic_Timer; + uint32 Countspell_Timer; + uint32 Blink_Timer; - //ArcaneExplosion_Timer - if (ArcaneExplosion_Timer <= diff) + void Reset() + { + ArcaneExplosion_Timer = 6000; //These times are probably wrong + ShazzrahCurse_Timer = 10000; + DeadenMagic_Timer = 24000; + Countspell_Timer = 15000; + Blink_Timer = 30000; + } + + void EnterCombat(Unit * /*who*/) { - DoCast(me->getVictim(), SPELL_ARCANEEXPLOSION); - ArcaneExplosion_Timer = 5000 + rand()%4000; - } else ArcaneExplosion_Timer -= diff; + } - //ShazzrahCurse_Timer - if (ShazzrahCurse_Timer <= diff) + void UpdateAI(const uint32 diff) { - Unit *pTarget = NULL; - pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); - if (pTarget) DoCast(pTarget, SPELL_SHAZZRAHCURSE); + if (!UpdateVictim()) + return; - ShazzrahCurse_Timer = 25000 + rand()%5000; - } else ShazzrahCurse_Timer -= diff; + //ArcaneExplosion_Timer + if (ArcaneExplosion_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_ARCANEEXPLOSION); + ArcaneExplosion_Timer = 5000 + rand()%4000; + } else ArcaneExplosion_Timer -= diff; - //DeadenMagic_Timer - if (DeadenMagic_Timer <= diff) - { - DoCast(me, SPELL_DEADENMAGIC); - DeadenMagic_Timer = 35000; - } else DeadenMagic_Timer -= diff; + //ShazzrahCurse_Timer + if (ShazzrahCurse_Timer <= diff) + { + Unit *pTarget = NULL; + pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); + if (pTarget) DoCast(pTarget, SPELL_SHAZZRAHCURSE); - //Countspell_Timer - if (Countspell_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_COUNTERSPELL); - Countspell_Timer = 16000 + rand()%4000; - } else Countspell_Timer -= diff; + ShazzrahCurse_Timer = 25000 + rand()%5000; + } else ShazzrahCurse_Timer -= diff; - //Blink_Timer - if (Blink_Timer <= diff) - { - // Teleporting him to a random gamer and casting Arcane Explosion after that. - // Blink is not working cause of LoS System we need to do this hardcoded. - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM,0, 100, true)) + //DeadenMagic_Timer + if (DeadenMagic_Timer <= diff) { - DoTeleportTo(pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ()); - DoCast(pTarget, SPELL_ARCANEEXPLOSION); - DoResetThreat(); - } + DoCast(me, SPELL_DEADENMAGIC); + DeadenMagic_Timer = 35000; + } else DeadenMagic_Timer -= diff; - Blink_Timer = 45000; - } else Blink_Timer -= diff; + //Countspell_Timer + if (Countspell_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_COUNTERSPELL); + Countspell_Timer = 16000 + rand()%4000; + } else Countspell_Timer -= diff; + + //Blink_Timer + if (Blink_Timer <= diff) + { + // Teleporting him to a random gamer and casting Arcane Explosion after that. + // Blink is not working cause of LoS System we need to do this hardcoded. + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM,0, 100, true)) + { + DoTeleportTo(pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ()); + DoCast(pTarget, SPELL_ARCANEEXPLOSION); + DoResetThreat(); + } + + Blink_Timer = 45000; + } else Blink_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_shazzrah(Creature* pCreature) -{ - return new boss_shazzrahAI (pCreature); -} void AddSC_boss_shazzrah() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_shazzrah"; - newscript->GetAI = &GetAI_boss_shazzrah; - newscript->RegisterSelf(); + new boss_shazzrah(); } - diff --git a/src/server/scripts/EasternKingdoms/MoltenCore/boss_sulfuron_harbinger.cpp b/src/server/scripts/EasternKingdoms/MoltenCore/boss_sulfuron_harbinger.cpp index 66d6d115b12..8c310115c05 100644 --- a/src/server/scripts/EasternKingdoms/MoltenCore/boss_sulfuron_harbinger.cpp +++ b/src/server/scripts/EasternKingdoms/MoltenCore/boss_sulfuron_harbinger.cpp @@ -36,172 +36,176 @@ EndScriptData */ #define SPELL_HEAL 19775 #define SPELL_SHADOWWORDPAIN 19776 #define SPELL_IMMOLATE 20294 - -struct boss_sulfuronAI : public ScriptedAI +
class boss_sulfuron : public CreatureScript { - boss_sulfuronAI(Creature *c) : ScriptedAI(c) {} - - uint32 Darkstrike_Timer; - uint32 DemoralizingShout_Timer; - uint32 Inspire_Timer; - uint32 Knockdown_Timer; - uint32 Flamespear_Timer; +public: + boss_sulfuron() : CreatureScript("boss_sulfuron") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - Darkstrike_Timer=10000; //These times are probably wrong - DemoralizingShout_Timer = 15000; - Inspire_Timer = 13000; - Knockdown_Timer = 6000; - Flamespear_Timer = 2000; + return new boss_sulfuronAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_sulfuronAI : public ScriptedAI { - } + boss_sulfuronAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + uint32 Darkstrike_Timer; + uint32 DemoralizingShout_Timer; + uint32 Inspire_Timer; + uint32 Knockdown_Timer; + uint32 Flamespear_Timer; - //DemoralizingShout_Timer - if (DemoralizingShout_Timer <= diff) + void Reset() + { + Darkstrike_Timer=10000; //These times are probably wrong + DemoralizingShout_Timer = 15000; + Inspire_Timer = 13000; + Knockdown_Timer = 6000; + Flamespear_Timer = 2000; + } + + void EnterCombat(Unit * /*who*/) { - DoCast(me->getVictim(), SPELL_DEMORALIZINGSHOUT); - DemoralizingShout_Timer = 15000 + rand()%5000; - } else DemoralizingShout_Timer -= diff; + } - //Inspire_Timer - if (Inspire_Timer <= diff) + void UpdateAI(const uint32 diff) { - Creature *pTarget = NULL; - std::list<Creature*> pList = DoFindFriendlyMissingBuff(45.0f,SPELL_INSPIRE); - if (!pList.empty()) + if (!UpdateVictim()) + return; + + //DemoralizingShout_Timer + if (DemoralizingShout_Timer <= diff) { - std::list<Creature*>::const_iterator i = pList.begin(); - advance(i, (rand()%pList.size())); - pTarget = (*i); - } + DoCast(me->getVictim(), SPELL_DEMORALIZINGSHOUT); + DemoralizingShout_Timer = 15000 + rand()%5000; + } else DemoralizingShout_Timer -= diff; - if (pTarget) - DoCast(pTarget, SPELL_INSPIRE); + //Inspire_Timer + if (Inspire_Timer <= diff) + { + Creature *pTarget = NULL; + std::list<Creature*> pList = DoFindFriendlyMissingBuff(45.0f,SPELL_INSPIRE); + if (!pList.empty()) + { + std::list<Creature*>::const_iterator i = pList.begin(); + advance(i, (rand()%pList.size())); + pTarget = (*i); + } - DoCast(me, SPELL_INSPIRE); + if (pTarget) + DoCast(pTarget, SPELL_INSPIRE); - Inspire_Timer = 20000 + rand()%6000; - } else Inspire_Timer -= diff; + DoCast(me, SPELL_INSPIRE); - //Knockdown_Timer - if (Knockdown_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_KNOCKDOWN); - Knockdown_Timer = 12000 + rand()%3000; - } else Knockdown_Timer -= diff; + Inspire_Timer = 20000 + rand()%6000; + } else Inspire_Timer -= diff; - //Flamespear_Timer - if (Flamespear_Timer <= diff) - { - Unit *pTarget = NULL; - pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); - if (pTarget) DoCast(pTarget, SPELL_FLAMESPEAR); + //Knockdown_Timer + if (Knockdown_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_KNOCKDOWN); + Knockdown_Timer = 12000 + rand()%3000; + } else Knockdown_Timer -= diff; - Flamespear_Timer = 12000 + rand()%4000; - } else Flamespear_Timer -= diff; + //Flamespear_Timer + if (Flamespear_Timer <= diff) + { + Unit *pTarget = NULL; + pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); + if (pTarget) DoCast(pTarget, SPELL_FLAMESPEAR); - //DarkStrike_Timer - if (Darkstrike_Timer <= diff) - { - DoCast(me, SPELL_DARKSTRIKE); - Darkstrike_Timer = 15000 + rand()%3000; - } else Darkstrike_Timer -= diff; + Flamespear_Timer = 12000 + rand()%4000; + } else Flamespear_Timer -= diff; - DoMeleeAttackIfReady(); - } -}; + //DarkStrike_Timer + if (Darkstrike_Timer <= diff) + { + DoCast(me, SPELL_DARKSTRIKE); + Darkstrike_Timer = 15000 + rand()%3000; + } else Darkstrike_Timer -= diff; -struct mob_flamewaker_priestAI : public ScriptedAI -{ - mob_flamewaker_priestAI(Creature *c) : ScriptedAI(c) {} + DoMeleeAttackIfReady(); + } + }; - uint32 Heal_Timer; - uint32 ShadowWordPain_Timer; - uint32 Immolate_Timer; +}; +
class mob_flamewaker_priest : public CreatureScript +{ +public: + mob_flamewaker_priest() : CreatureScript("mob_flamewaker_priest") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - Heal_Timer = 15000+rand()%15000; - ShadowWordPain_Timer = 2000; - Immolate_Timer = 8000; + return new mob_flamewaker_priestAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct mob_flamewaker_priestAI : public ScriptedAI { - } + mob_flamewaker_priestAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + uint32 Heal_Timer; + uint32 ShadowWordPain_Timer; + uint32 Immolate_Timer; + + void Reset() + { + Heal_Timer = 15000+rand()%15000; + ShadowWordPain_Timer = 2000; + Immolate_Timer = 8000; + } + + void EnterCombat(Unit * /*who*/) + { + } - //Casting Heal to Sulfuron or other Guards. - if (Heal_Timer <= diff) + void UpdateAI(const uint32 diff) { - Unit* pUnit = DoSelectLowestHpFriendly(60.0f, 1); - if (!pUnit) + if (!UpdateVictim()) return; - DoCast(pUnit, SPELL_HEAL); + //Casting Heal to Sulfuron or other Guards. + if (Heal_Timer <= diff) + { + Unit* pUnit = DoSelectLowestHpFriendly(60.0f, 1); + if (!pUnit) + return; - Heal_Timer = 15000+rand()%5000; - } else Heal_Timer -= diff; + DoCast(pUnit, SPELL_HEAL); - //ShadowWordPain_Timer - if (ShadowWordPain_Timer <= diff) - { - Unit *pTarget = NULL; - pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); - if (pTarget) DoCast(pTarget, SPELL_SHADOWWORDPAIN); + Heal_Timer = 15000+rand()%5000; + } else Heal_Timer -= diff; - ShadowWordPain_Timer = 18000+rand()%8000; - } else ShadowWordPain_Timer -= diff; + //ShadowWordPain_Timer + if (ShadowWordPain_Timer <= diff) + { + Unit *pTarget = NULL; + pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); + if (pTarget) DoCast(pTarget, SPELL_SHADOWWORDPAIN); - //Immolate_Timer - if (Immolate_Timer <= diff) - { - Unit *pTarget = NULL; - pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); - if (pTarget) DoCast(pTarget, SPELL_IMMOLATE); + ShadowWordPain_Timer = 18000+rand()%8000; + } else ShadowWordPain_Timer -= diff; + + //Immolate_Timer + if (Immolate_Timer <= diff) + { + Unit *pTarget = NULL; + pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); + if (pTarget) DoCast(pTarget, SPELL_IMMOLATE); - Immolate_Timer = 15000+rand()%10000; - } else Immolate_Timer -= diff; + Immolate_Timer = 15000+rand()%10000; + } else Immolate_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_sulfuron(Creature* pCreature) -{ - return new boss_sulfuronAI (pCreature); -} -CreatureAI* GetAI_mob_flamewaker_priest(Creature* pCreature) -{ - return new mob_flamewaker_priestAI (pCreature); -} void AddSC_boss_sulfuron() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_sulfuron"; - newscript->GetAI = &GetAI_boss_sulfuron; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_flamewaker_priest"; - newscript->GetAI = &GetAI_mob_flamewaker_priest; - newscript->RegisterSelf(); + new boss_sulfuron(); + new mob_flamewaker_priest(); } - diff --git a/src/server/scripts/EasternKingdoms/MoltenCore/instance_molten_core.cpp b/src/server/scripts/EasternKingdoms/MoltenCore/instance_molten_core.cpp index fb313fba3ae..64036906164 100644 --- a/src/server/scripts/EasternKingdoms/MoltenCore/instance_molten_core.cpp +++ b/src/server/scripts/EasternKingdoms/MoltenCore/instance_molten_core.cpp @@ -39,230 +39,232 @@ EndScriptData */ #define ID_DOMO 12018 #define ID_RAGNAROS 11502 #define ID_FLAMEWAKERPRIEST 11662 - -struct instance_molten_core : public ScriptedInstance +
class instance_molten_core : public InstanceMapScript { - instance_molten_core(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; - - uint64 Lucifron, Magmadar, Gehennas, Garr, Geddon, Shazzrah, Sulfuron, Golemagg, Domo, Ragnaros, FlamewakerPriest; - uint64 RuneKoro, RuneZeth, RuneMazj, RuneTheri, RuneBlaz, RuneKress, RuneMohn, m_uiFirelordCacheGUID; - - //If all Bosses are dead. - bool IsBossDied[9]; - - uint32 m_auiEncounter[MAX_ENCOUNTER]; +public: + instance_molten_core() : InstanceMapScript("instance_molten_core") { } - void Initialize() + InstanceScript* GetInstance_InstanceMapScript(Map* pMap) { - memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - - Lucifron = 0; - Magmadar = 0; - Gehennas = 0; - Garr = 0; - Geddon = 0; - Shazzrah = 0; - Sulfuron = 0; - Golemagg = 0; - Domo = 0; - Ragnaros = 0; - FlamewakerPriest = 0; - - RuneKoro = 0; - RuneZeth = 0; - RuneMazj = 0; - RuneTheri = 0; - RuneBlaz = 0; - RuneKress = 0; - RuneMohn = 0; - - m_uiFirelordCacheGUID = 0; - - IsBossDied[0] = false; - IsBossDied[1] = false; - IsBossDied[2] = false; - IsBossDied[3] = false; - IsBossDied[4] = false; - IsBossDied[5] = false; - IsBossDied[6] = false; - - IsBossDied[7] = false; - IsBossDied[8] = false; + return new instance_molten_core_InstanceMapScript (pMap); } - bool IsEncounterInProgress() const + struct instance_molten_core_InstanceMapScript : public InstanceScript { - return false; - }; + instance_molten_core_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {Initialize();}; - void OnGameObjectCreate(GameObject* pGo, bool /*add*/) - { - switch(pGo->GetEntry()) + uint64 Lucifron, Magmadar, Gehennas, Garr, Geddon, Shazzrah, Sulfuron, Golemagg, Domo, Ragnaros, FlamewakerPriest; + uint64 RuneKoro, RuneZeth, RuneMazj, RuneTheri, RuneBlaz, RuneKress, RuneMohn, m_uiFirelordCacheGUID; + + //If all Bosses are dead. + bool IsBossDied[9]; + + uint32 m_auiEncounter[MAX_ENCOUNTER]; + + void Initialize() { - case 176951: //Sulfuron - RuneKoro = pGo->GetGUID(); - break; - case 176952: //Geddon - RuneZeth = pGo->GetGUID(); - break; - case 176953: //Shazzrah - RuneMazj = pGo->GetGUID(); - break; - case 176954: //Golemagg - RuneTheri = pGo->GetGUID(); - break; - case 176955: //Garr - RuneBlaz = pGo->GetGUID(); - break; - case 176956: //Magmadar - RuneKress = pGo->GetGUID(); - break; - case 176957: //Gehennas - RuneMohn = pGo->GetGUID(); - break; - case 179703: - m_uiFirelordCacheGUID = pGo->GetGUID(); //when majordomo event == DONE DoRespawnGameObject(m_uiFirelordCacheGUID,); - break; + memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); + + Lucifron = 0; + Magmadar = 0; + Gehennas = 0; + Garr = 0; + Geddon = 0; + Shazzrah = 0; + Sulfuron = 0; + Golemagg = 0; + Domo = 0; + Ragnaros = 0; + FlamewakerPriest = 0; + + RuneKoro = 0; + RuneZeth = 0; + RuneMazj = 0; + RuneTheri = 0; + RuneBlaz = 0; + RuneKress = 0; + RuneMohn = 0; + + m_uiFirelordCacheGUID = 0; + + IsBossDied[0] = false; + IsBossDied[1] = false; + IsBossDied[2] = false; + IsBossDied[3] = false; + IsBossDied[4] = false; + IsBossDied[5] = false; + IsBossDied[6] = false; + + IsBossDied[7] = false; + IsBossDied[8] = false; } - } - void OnCreatureCreate(Creature* pCreature, bool /*add*/) - { - switch (pCreature->GetEntry()) + bool IsEncounterInProgress() const { - case ID_LUCIFRON: - Lucifron = pCreature->GetGUID(); - break; + return false; + }; - case ID_MAGMADAR: - Magmadar = pCreature->GetGUID(); - break; - - case ID_GEHENNAS: - Gehennas = pCreature->GetGUID(); - break; - - case ID_GARR: - Garr = pCreature->GetGUID(); + void OnGameObjectCreate(GameObject* pGo, bool /*add*/) + { + switch(pGo->GetEntry()) + { + case 176951: //Sulfuron + RuneKoro = pGo->GetGUID(); break; - - case ID_GEDDON: - Geddon = pCreature->GetGUID(); + case 176952: //Geddon + RuneZeth = pGo->GetGUID(); break; - - case ID_SHAZZRAH: - Shazzrah = pCreature->GetGUID(); + case 176953: //Shazzrah + RuneMazj = pGo->GetGUID(); break; - - case ID_SULFURON: - Sulfuron = pCreature->GetGUID(); + case 176954: //Golemagg + RuneTheri = pGo->GetGUID(); break; - - case ID_GOLEMAGG: - Golemagg = pCreature->GetGUID(); + case 176955: //Garr + RuneBlaz = pGo->GetGUID(); break; - - case ID_DOMO: - Domo = pCreature->GetGUID(); + case 176956: //Magmadar + RuneKress = pGo->GetGUID(); break; - - case ID_RAGNAROS: - Ragnaros = pCreature->GetGUID(); + case 176957: //Gehennas + RuneMohn = pGo->GetGUID(); break; - - case ID_FLAMEWAKERPRIEST: - FlamewakerPriest = pCreature->GetGUID(); + case 179703: + m_uiFirelordCacheGUID = pGo->GetGUID(); //when majordomo event == DONE DoRespawnGameObject(m_uiFirelordCacheGUID,); break; + } } - } - uint64 GetData64 (uint32 identifier) - { - switch(identifier) + void OnCreatureCreate(Creature* pCreature, bool /*add*/) { - case DATA_SULFURON: - return Sulfuron; - case DATA_GOLEMAGG: - return Golemagg; - - case DATA_FLAMEWAKERPRIEST: - return FlamewakerPriest; + switch (pCreature->GetEntry()) + { + case ID_LUCIFRON: + Lucifron = pCreature->GetGUID(); + break; + + case ID_MAGMADAR: + Magmadar = pCreature->GetGUID(); + break; + + case ID_GEHENNAS: + Gehennas = pCreature->GetGUID(); + break; + + case ID_GARR: + Garr = pCreature->GetGUID(); + break; + + case ID_GEDDON: + Geddon = pCreature->GetGUID(); + break; + + case ID_SHAZZRAH: + Shazzrah = pCreature->GetGUID(); + break; + + case ID_SULFURON: + Sulfuron = pCreature->GetGUID(); + break; + + case ID_GOLEMAGG: + Golemagg = pCreature->GetGUID(); + break; + + case ID_DOMO: + Domo = pCreature->GetGUID(); + break; + + case ID_RAGNAROS: + Ragnaros = pCreature->GetGUID(); + break; + + case ID_FLAMEWAKERPRIEST: + FlamewakerPriest = pCreature->GetGUID(); + break; + } } - return 0; - } - - uint32 GetData(uint32 type) - { - switch(type) + uint64 GetData64 (uint32 identifier) { - case DATA_LUCIFRONISDEAD: - if (IsBossDied[0]) - return 1; - break; - - case DATA_MAGMADARISDEAD: - if (IsBossDied[1]) - return 1; - break; - - case DATA_GEHENNASISDEAD: - if (IsBossDied[2]) - return 1; - break; - - case DATA_GARRISDEAD: - if (IsBossDied[3]) - return 1; - break; - - case DATA_GEDDONISDEAD: - if (IsBossDied[4]) - return 1; - break; - - case DATA_SHAZZRAHISDEAD: - if (IsBossDied[5]) - return 1; - break; - - case DATA_SULFURONISDEAD: - if (IsBossDied[6]) - return 1; - break; - - case DATA_GOLEMAGGISDEAD: - if (IsBossDied[7]) - return 1; - break; + switch(identifier) + { + case DATA_SULFURON: + return Sulfuron; + case DATA_GOLEMAGG: + return Golemagg; + + case DATA_FLAMEWAKERPRIEST: + return FlamewakerPriest; + } + + return 0; + } - case DATA_MAJORDOMOISDEAD: - if (IsBossDied[8]) - return 1; - break; + uint32 GetData(uint32 type) + { + switch(type) + { + case DATA_LUCIFRONISDEAD: + if (IsBossDied[0]) + return 1; + break; + + case DATA_MAGMADARISDEAD: + if (IsBossDied[1]) + return 1; + break; + + case DATA_GEHENNASISDEAD: + if (IsBossDied[2]) + return 1; + break; + + case DATA_GARRISDEAD: + if (IsBossDied[3]) + return 1; + break; + + case DATA_GEDDONISDEAD: + if (IsBossDied[4]) + return 1; + break; + + case DATA_SHAZZRAHISDEAD: + if (IsBossDied[5]) + return 1; + break; + + case DATA_SULFURONISDEAD: + if (IsBossDied[6]) + return 1; + break; + + case DATA_GOLEMAGGISDEAD: + if (IsBossDied[7]) + return 1; + break; + + case DATA_MAJORDOMOISDEAD: + if (IsBossDied[8]) + return 1; + break; + } + + return 0; } - return 0; - } + void SetData(uint32 type, uint32 /*data*/) + { + if (type == DATA_GOLEMAGG_DEATH) + IsBossDied[7] = true; + } + }; - void SetData(uint32 type, uint32 /*data*/) - { - if (type == DATA_GOLEMAGG_DEATH) - IsBossDied[7] = true; - } }; -InstanceData* GetInstance_instance_molten_core(Map* pMap) -{ - return new instance_molten_core (pMap); -} void AddSC_instance_molten_core() { - Script *newscript; - newscript = new Script; - newscript->Name = "instance_molten_core"; - newscript->GetInstanceData = &GetInstance_instance_molten_core; - newscript->RegisterSelf(); + new instance_molten_core(); } - diff --git a/src/server/scripts/EasternKingdoms/MoltenCore/molten_core.cpp b/src/server/scripts/EasternKingdoms/MoltenCore/molten_core.cpp index 5a77af76d63..bae4b1fe19c 100644 --- a/src/server/scripts/EasternKingdoms/MoltenCore/molten_core.cpp +++ b/src/server/scripts/EasternKingdoms/MoltenCore/molten_core.cpp @@ -40,44 +40,44 @@ EndContentData */ #define SPELL_WITHERING_HEAT 19367 #define SPELL_ANCIENT_DESPAIR 19369 #define SPELL_ANCIENT_HYSTERIA 19372 - -CreatureAI* GetAI_mob_ancient_core_hound(Creature* pCreature) +
class mob_ancient_core_hound : public CreatureScript { - SimpleAI *ai = new SimpleAI(pCreature); +public: + mob_ancient_core_hound() : CreatureScript("mob_ancient_core_hound") { } - ai->Spell[0].Enabled = true; - ai->Spell[0].Spell_Id = SPELL_CONE_OF_FIRE; - ai->Spell[0].Cooldown = 7000; - ai->Spell[0].First_Cast = 10000; - ai->Spell[0].Cast_Target_Type = CAST_HOSTILE_TARGET; + CreatureAI* GetAI(Creature* pCreature) const + { + SimpleAI *ai = new SimpleAI(pCreature); - uint32 RandDebuff = RAND(SPELL_GROUND_STOMP,SPELL_ANCIENT_DREAD,SPELL_CAUTERIZING_FLAMES, - SPELL_WITHERING_HEAT,SPELL_ANCIENT_DESPAIR,SPELL_ANCIENT_HYSTERIA); + ai->Spell[0].Enabled = true; + ai->Spell[0].Spell_Id = SPELL_CONE_OF_FIRE; + ai->Spell[0].Cooldown = 7000; + ai->Spell[0].First_Cast = 10000; + ai->Spell[0].Cast_Target_Type = CAST_HOSTILE_TARGET; - ai->Spell[1].Enabled = true; - ai->Spell[1].Spell_Id = RandDebuff; - ai->Spell[1].Cooldown = 24000; - ai->Spell[1].First_Cast = 15000; - ai->Spell[1].Cast_Target_Type = CAST_HOSTILE_TARGET; + uint32 RandDebuff = RAND(SPELL_GROUND_STOMP,SPELL_ANCIENT_DREAD,SPELL_CAUTERIZING_FLAMES, + SPELL_WITHERING_HEAT,SPELL_ANCIENT_DESPAIR,SPELL_ANCIENT_HYSTERIA); - ai->Spell[2].Enabled = true; - ai->Spell[2].Spell_Id = SPELL_BITE; - ai->Spell[2].Cooldown = 6000; - ai->Spell[2].First_Cast = 4000; - ai->Spell[2].Cast_Target_Type = CAST_HOSTILE_TARGET; + ai->Spell[1].Enabled = true; + ai->Spell[1].Spell_Id = RandDebuff; + ai->Spell[1].Cooldown = 24000; + ai->Spell[1].First_Cast = 15000; + ai->Spell[1].Cast_Target_Type = CAST_HOSTILE_TARGET; - ai->EnterEvadeMode(); + ai->Spell[2].Enabled = true; + ai->Spell[2].Spell_Id = SPELL_BITE; + ai->Spell[2].Cooldown = 6000; + ai->Spell[2].First_Cast = 4000; + ai->Spell[2].Cast_Target_Type = CAST_HOSTILE_TARGET; - return ai; -} + ai->EnterEvadeMode(); + + return ai; + } + +}; void AddSC_molten_core() { - Script *newscript; - - newscript = new Script; - newscript->Name = "mob_ancient_core_hound"; - newscript->GetAI = &GetAI_mob_ancient_core_hound; - newscript->RegisterSelf(); + new mob_ancient_core_hound(); } - diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp index f97b7faaec4..0345810478b 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp @@ -89,220 +89,240 @@ enum UnworthyInitiatePhase PHASE_TO_ATTACK, PHASE_ATTACKING, }; - -struct npc_unworthy_initiateAI : public ScriptedAI +
class npc_unworthy_initiate : public CreatureScript { - npc_unworthy_initiateAI(Creature *c) : ScriptedAI(c) - { - me->SetReactState(REACT_PASSIVE); - if (!me->GetEquipmentId()) - if (const CreatureInfo *info = GetCreatureInfo(28406)) - if (info->equipmentId) - const_cast<CreatureInfo*>(me->GetCreatureInfo())->equipmentId = info->equipmentId; - } +public: + npc_unworthy_initiate() : CreatureScript("npc_unworthy_initiate") { } - uint64 playerGUID; - UnworthyInitiatePhase phase; - uint32 wait_timer; - float anchorX, anchorY; - uint64 anchorGUID; - - EventMap events; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - anchorGUID = 0; - phase = PHASE_CHAINED; - events.Reset(); - me->setFaction(7); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); - me->SetUInt32Value(UNIT_FIELD_BYTES_1, 8); - me->LoadEquipment(0, true); + return new npc_unworthy_initiateAI(pCreature); } - void EnterCombat(Unit * /*who*/) + struct npc_unworthy_initiateAI : public ScriptedAI { - events.ScheduleEvent(EVENT_ICY_TOUCH, 1000, GCD_CAST); - events.ScheduleEvent(EVENT_PLAGUE_STRIKE, 3000, GCD_CAST); - events.ScheduleEvent(EVENT_BLOOD_STRIKE, 2000, GCD_CAST); - events.ScheduleEvent(EVENT_DEATH_COIL, 5000, GCD_CAST); - } - - void MovementInform(uint32 type, uint32 id) - { - if (type != POINT_MOTION_TYPE) - return; - - if (id == 1) + npc_unworthy_initiateAI(Creature *c) : ScriptedAI(c) { - wait_timer = 5000; - me->CastSpell(me, SPELL_DK_INITIATE_VISUAL, true); - - if (Player* starter = Unit::GetPlayer(*me, playerGUID)) - DoScriptText(say_event_attack[rand()%9], me, starter); - - phase = PHASE_TO_ATTACK; + me->SetReactState(REACT_PASSIVE); + if (!me->GetEquipmentId()) + if (const CreatureInfo *info = GetCreatureInfo(28406)) + if (info->equipmentId) + const_cast<CreatureInfo*>(me->GetCreatureInfo())->equipmentId = info->equipmentId; } - } - void EventStart(Creature* anchor, Player *pTarget) - { - wait_timer = 5000; - phase = PHASE_TO_EQUIP; + uint64 playerGUID; + UnworthyInitiatePhase phase; + uint32 wait_timer; + float anchorX, anchorY; + uint64 anchorGUID; - me->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); - me->RemoveAurasDueToSpell(SPELL_SOUL_PRISON_CHAIN_SELF); - me->RemoveAurasDueToSpell(SPELL_SOUL_PRISON_CHAIN); + EventMap events; - float z; - anchor->GetContactPoint(me, anchorX, anchorY, z, 1.0f); + void Reset() + { + anchorGUID = 0; + phase = PHASE_CHAINED; + events.Reset(); + me->setFaction(7); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->SetUInt32Value(UNIT_FIELD_BYTES_1, 8); + me->LoadEquipment(0, true); + } - playerGUID = pTarget->GetGUID(); - DoScriptText(say_event_start[rand()%8], me, pTarget); - } + void EnterCombat(Unit * /*who*/) + { + events.ScheduleEvent(EVENT_ICY_TOUCH, 1000, GCD_CAST); + events.ScheduleEvent(EVENT_PLAGUE_STRIKE, 3000, GCD_CAST); + events.ScheduleEvent(EVENT_BLOOD_STRIKE, 2000, GCD_CAST); + events.ScheduleEvent(EVENT_DEATH_COIL, 5000, GCD_CAST); + } - void UpdateAI(const uint32 diff); -}; + void MovementInform(uint32 type, uint32 id) + { + if (type != POINT_MOTION_TYPE) + return; -CreatureAI* GetAI_npc_unworthy_initiate(Creature* pCreature) -{ - return new npc_unworthy_initiateAI(pCreature); -} + if (id == 1) + { + wait_timer = 5000; + me->CastSpell(me, SPELL_DK_INITIATE_VISUAL, true); -struct npc_unworthy_initiate_anchorAI : public PassiveAI -{ - npc_unworthy_initiate_anchorAI(Creature *c) : PassiveAI(c), prisonerGUID(0) {} + if (Player* starter = Unit::GetPlayer(*me, playerGUID)) + DoScriptText(say_event_attack[rand()%9], me, starter); - uint64 prisonerGUID; + phase = PHASE_TO_ATTACK; + } + } - void SetGUID(const uint64 &guid, int32 /*id*/) - { - if (!prisonerGUID) - prisonerGUID = guid; - } + void EventStart(Creature* anchor, Player *pTarget) + { + wait_timer = 5000; + phase = PHASE_TO_EQUIP; - uint64 GetGUID(int32 /*id*/) { return prisonerGUID; } -}; + me->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); + me->RemoveAurasDueToSpell(SPELL_SOUL_PRISON_CHAIN_SELF); + me->RemoveAurasDueToSpell(SPELL_SOUL_PRISON_CHAIN); -void npc_unworthy_initiateAI::UpdateAI(const uint32 diff) -{ - switch(phase) - { - case PHASE_CHAINED: - if (!anchorGUID) - { - if (Creature *anchor = me->FindNearestCreature(29521, 30)) - { - anchor->AI()->SetGUID(me->GetGUID()); - anchor->CastSpell(me, SPELL_SOUL_PRISON_CHAIN, true); - anchorGUID = anchor->GetGUID(); - } - else - sLog.outError("npc_unworthy_initiateAI: unable to find anchor!"); + float z; + anchor->GetContactPoint(me, anchorX, anchorY, z, 1.0f); - float dist = 99.0f; - GameObject *prison = NULL; + playerGUID = pTarget->GetGUID(); + DoScriptText(say_event_start[rand()%8], me, pTarget); + } - for (uint8 i = 0; i < 12; ++i) + void UpdateAI(const uint32 diff) + { + switch(phase) { - if (GameObject* temp_prison = me->FindNearestGameObject(acherus_soul_prison[i],30)) + case PHASE_CHAINED: + if (!anchorGUID) { - if (me->IsWithinDist(temp_prison, dist, false)) + if (Creature *anchor = me->FindNearestCreature(29521, 30)) { - dist = me->GetDistance2d(temp_prison); - prison = temp_prison; + anchor->AI()->SetGUID(me->GetGUID()); + anchor->CastSpell(me, SPELL_SOUL_PRISON_CHAIN, true); + anchorGUID = anchor->GetGUID(); } + else + sLog.outError("npc_unworthy_initiateAI: unable to find anchor!"); + + float dist = 99.0f; + GameObject *prison = NULL; + + for (uint8 i = 0; i < 12; ++i) + { + if (GameObject* temp_prison = me->FindNearestGameObject(acherus_soul_prison[i],30)) + { + if (me->IsWithinDist(temp_prison, dist, false)) + { + dist = me->GetDistance2d(temp_prison); + prison = temp_prison; + } + } + } + + if (prison) + prison->ResetDoorOrButton(); + else + sLog.outError("npc_unworthy_initiateAI: unable to find prison!"); } - } - - if (prison) - prison->ResetDoorOrButton(); - else - sLog.outError("npc_unworthy_initiateAI: unable to find prison!"); - } - return; - case PHASE_TO_EQUIP: - if (wait_timer) - { - if (wait_timer > diff) - wait_timer -= diff; - else - { - me->GetMotionMaster()->MovePoint(1, anchorX, anchorY, me->GetPositionZ()); - //sLog.outDebug("npc_unworthy_initiateAI: move to %f %f %f", anchorX, anchorY, me->GetPositionZ()); - phase = PHASE_EQUIPING; - wait_timer = 0; + return; + case PHASE_TO_EQUIP: + if (wait_timer) + { + if (wait_timer > diff) + wait_timer -= diff; + else + { + me->GetMotionMaster()->MovePoint(1, anchorX, anchorY, me->GetPositionZ()); + //sLog.outDebug("npc_unworthy_initiateAI: move to %f %f %f", anchorX, anchorY, me->GetPositionZ()); + phase = PHASE_EQUIPING; + wait_timer = 0; + } + } + return; + case PHASE_TO_ATTACK: + if (wait_timer) + { + if (wait_timer > diff) + wait_timer -= diff; + else + { + me->setFaction(14); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + phase = PHASE_ATTACKING; + + if (Player *pTarget = Unit::GetPlayer(*me, playerGUID)) + me->AI()->AttackStart(pTarget); + wait_timer = 0; + } + } + return; + case PHASE_ATTACKING: + if (!UpdateVictim()) + return; + + events.Update(diff); + + while (uint32 eventId = events.ExecuteEvent()) + { + switch(eventId) + { + case EVENT_ICY_TOUCH: + DoCast(me->getVictim(), SPELL_ICY_TOUCH); + events.DelayEvents(1000, GCD_CAST); + events.ScheduleEvent(EVENT_ICY_TOUCH, 5000, GCD_CAST); + break; + case EVENT_PLAGUE_STRIKE: + DoCast(me->getVictim(), SPELL_PLAGUE_STRIKE); + events.DelayEvents(1000, GCD_CAST); + events.ScheduleEvent(SPELL_PLAGUE_STRIKE, 5000, GCD_CAST); + break; + case EVENT_BLOOD_STRIKE: + DoCast(me->getVictim(), SPELL_BLOOD_STRIKE); + events.DelayEvents(1000, GCD_CAST); + events.ScheduleEvent(EVENT_BLOOD_STRIKE, 5000, GCD_CAST); + break; + case EVENT_DEATH_COIL: + DoCast(me->getVictim(), SPELL_DEATH_COIL); + events.DelayEvents(1000, GCD_CAST); + events.ScheduleEvent(EVENT_DEATH_COIL, 5000, GCD_CAST); + break; + } + } + + DoMeleeAttackIfReady(); } } - return; - case PHASE_TO_ATTACK: - if (wait_timer) - { - if (wait_timer > diff) - wait_timer -= diff; - else - { - me->setFaction(14); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); - phase = PHASE_ATTACKING; + }; - if (Player *pTarget = Unit::GetPlayer(*me, playerGUID)) - me->AI()->AttackStart(pTarget); - wait_timer = 0; - } - } - return; - case PHASE_ATTACKING: - if (!UpdateVictim()) - return; +}; - events.Update(diff); +
class npc_unworthy_initiate_anchor : public CreatureScript +{ +public: + npc_unworthy_initiate_anchor() : CreatureScript("npc_unworthy_initiate_anchor") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_unworthy_initiate_anchorAI(pCreature); + } + + struct npc_unworthy_initiate_anchorAI : public PassiveAI + { + npc_unworthy_initiate_anchorAI(Creature *c) : PassiveAI(c), prisonerGUID(0) {} + + uint64 prisonerGUID; - while (uint32 eventId = events.ExecuteEvent()) + void SetGUID(const uint64 &guid, int32 /*id*/) { - switch(eventId) - { - case EVENT_ICY_TOUCH: - DoCast(me->getVictim(), SPELL_ICY_TOUCH); - events.DelayEvents(1000, GCD_CAST); - events.ScheduleEvent(EVENT_ICY_TOUCH, 5000, GCD_CAST); - break; - case EVENT_PLAGUE_STRIKE: - DoCast(me->getVictim(), SPELL_PLAGUE_STRIKE); - events.DelayEvents(1000, GCD_CAST); - events.ScheduleEvent(SPELL_PLAGUE_STRIKE, 5000, GCD_CAST); - break; - case EVENT_BLOOD_STRIKE: - DoCast(me->getVictim(), SPELL_BLOOD_STRIKE); - events.DelayEvents(1000, GCD_CAST); - events.ScheduleEvent(EVENT_BLOOD_STRIKE, 5000, GCD_CAST); - break; - case EVENT_DEATH_COIL: - DoCast(me->getVictim(), SPELL_DEATH_COIL); - events.DelayEvents(1000, GCD_CAST); - events.ScheduleEvent(EVENT_DEATH_COIL, 5000, GCD_CAST); - break; - } + if (!prisonerGUID) + prisonerGUID = guid; } - DoMeleeAttackIfReady(); - } -} + uint64 GetGUID(int32 /*id*/) { return prisonerGUID; } + }; + +}; + -CreatureAI* GetAI_npc_unworthy_initiate_anchor(Creature* pCreature) -{ - return new npc_unworthy_initiate_anchorAI(pCreature); -} -bool GOHello_go_acherus_soul_prison(Player* pPlayer, GameObject* pGo) +
class go_acherus_soul_prison : public GameObjectScript { - if (Creature *anchor = pGo->FindNearestCreature(29521, 15)) - if (uint64 prisonerGUID = anchor->AI()->GetGUID()) - if (Creature* prisoner = Creature::GetCreature(*pPlayer, prisonerGUID)) - CAST_AI(npc_unworthy_initiateAI, prisoner->AI())->EventStart(anchor, pPlayer); +public: + go_acherus_soul_prison() : GameObjectScript("go_acherus_soul_prison") { } - return false; -} + bool OnGossipHello(Player* pPlayer, GameObject* pGo) + { + if (Creature *anchor = pGo->FindNearestCreature(29521, 15)) + if (uint64 prisonerGUID = anchor->AI()->GetGUID()) + if (Creature* prisoner = Creature::GetCreature(*pPlayer, prisonerGUID)) + CAST_AI(npc_unworthy_initiate::npc_unworthy_initiateAI, prisoner->AI())->EventStart(anchor, pPlayer); + + return false; + } + +}; /*###### ## npc_death_knight_initiate @@ -335,154 +355,163 @@ int32 m_auiRandomSay[] = { SAY_DUEL_A, SAY_DUEL_B, SAY_DUEL_C, SAY_DUEL_D, SAY_DUEL_E, SAY_DUEL_F, SAY_DUEL_G, SAY_DUEL_H, SAY_DUEL_I }; - -struct npc_death_knight_initiateAI : public CombatAI +
class npc_death_knight_initiate : public CreatureScript { - npc_death_knight_initiateAI(Creature* pCreature) : CombatAI(pCreature) +public: + npc_death_knight_initiate() : CreatureScript("npc_death_knight_initiate") { } + + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - m_bIsDuelInProgress = false; - } + if (uiAction == GOSSIP_ACTION_INFO_DEF) + { + pPlayer->CLOSE_GOSSIP_MENU(); - bool lose; - uint64 m_uiDuelerGUID; - uint32 m_uiDuelTimer; - bool m_bIsDuelInProgress; + if (pPlayer->isInCombat() || pCreature->isInCombat()) + return true; - void Reset() - { - lose = false; - me->RestoreFaction(); - CombatAI::Reset(); + if (npc_death_knight_initiateAI* pInitiateAI = CAST_AI(npc_death_knight_initiate::npc_death_knight_initiateAI, pCreature->AI())) + { + if (pInitiateAI->m_bIsDuelInProgress) + return true; + } - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_15); + pCreature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + pCreature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_15); - m_uiDuelerGUID = 0; - m_uiDuelTimer = 5000; - m_bIsDuelInProgress = false; + int32 uiSayId = rand()% (sizeof(m_auiRandomSay)/sizeof(int32)); + DoScriptText(m_auiRandomSay[uiSayId], pCreature, pPlayer); + + pPlayer->CastSpell(pCreature, SPELL_DUEL, false); + pPlayer->CastSpell(pPlayer, SPELL_DUEL_FLAG, true); + } + return true; } - void SpellHit(Unit* pCaster, const SpellEntry* pSpell) + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - if (!m_bIsDuelInProgress && pSpell->Id == SPELL_DUEL) + if (pPlayer->GetQuestStatus(QUEST_DEATH_CHALLENGE) == QUEST_STATUS_INCOMPLETE && pCreature->GetHealth() == pCreature->GetMaxHealth()) { - m_uiDuelerGUID = pCaster->GetGUID(); - m_bIsDuelInProgress = true; + if (pPlayer->GetHealth() * 10 < pPlayer->GetMaxHealth()) + return true; + + if (pPlayer->isInCombat() || pCreature->isInCombat()) + return true; + + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ACCEPT_DUEL, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature),pCreature->GetGUID()); } + return true; } - void DamageTaken(Unit* pDoneBy, uint32 &uiDamage) + CreatureAI* GetAI(Creature* pCreature) const { - if (m_bIsDuelInProgress && pDoneBy->IsControlledByPlayer()) + return new npc_death_knight_initiateAI(pCreature); + } + + struct npc_death_knight_initiateAI : public CombatAI + { + npc_death_knight_initiateAI(Creature* pCreature) : CombatAI(pCreature) { - if (pDoneBy->GetGUID() != m_uiDuelerGUID && pDoneBy->GetOwnerGUID() != m_uiDuelerGUID) // other players cannot help - uiDamage = 0; - else if (uiDamage >= me->GetHealth()) - { - uiDamage = 0; + m_bIsDuelInProgress = false; + } - if (!lose) - { - pDoneBy->RemoveGameObject(SPELL_DUEL_FLAG, true); - pDoneBy->AttackStop(); - me->CastSpell(pDoneBy, SPELL_DUEL_VICTORY, true); - lose = true; - me->CastSpell(me, 7267, true); - me->RestoreFaction(); - } + bool lose; + uint64 m_uiDuelerGUID; + uint32 m_uiDuelTimer; + bool m_bIsDuelInProgress; + + void Reset() + { + lose = false; + me->RestoreFaction(); + CombatAI::Reset(); + + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_15); + + m_uiDuelerGUID = 0; + m_uiDuelTimer = 5000; + m_bIsDuelInProgress = false; + } + + void SpellHit(Unit* pCaster, const SpellEntry* pSpell) + { + if (!m_bIsDuelInProgress && pSpell->Id == SPELL_DUEL) + { + m_uiDuelerGUID = pCaster->GetGUID(); + m_bIsDuelInProgress = true; } } - } - void UpdateAI(const uint32 uiDiff) - { - if (!UpdateVictim()) + void DamageTaken(Unit* pDoneBy, uint32 &uiDamage) { - if (m_bIsDuelInProgress) + if (m_bIsDuelInProgress && pDoneBy->IsControlledByPlayer()) { - if (m_uiDuelTimer <= uiDiff) + if (pDoneBy->GetGUID() != m_uiDuelerGUID && pDoneBy->GetOwnerGUID() != m_uiDuelerGUID) // other players cannot help + uiDamage = 0; + else if (uiDamage >= me->GetHealth()) { - me->setFaction(FACTION_HOSTILE); + uiDamage = 0; - if (Unit* pUnit = Unit::GetUnit(*me, m_uiDuelerGUID)) - AttackStart(pUnit); + if (!lose) + { + pDoneBy->RemoveGameObject(SPELL_DUEL_FLAG, true); + pDoneBy->AttackStop(); + me->CastSpell(pDoneBy, SPELL_DUEL_VICTORY, true); + lose = true; + me->CastSpell(me, 7267, true); + me->RestoreFaction(); + } } - else - m_uiDuelTimer -= uiDiff; } - return; } - if (m_bIsDuelInProgress) + void UpdateAI(const uint32 uiDiff) { - if (lose) + if (!UpdateVictim()) { - if (!me->HasAura(7267)) - EnterEvadeMode(); + if (m_bIsDuelInProgress) + { + if (m_uiDuelTimer <= uiDiff) + { + me->setFaction(FACTION_HOSTILE); + + if (Unit* pUnit = Unit::GetUnit(*me, m_uiDuelerGUID)) + AttackStart(pUnit); + } + else + m_uiDuelTimer -= uiDiff; + } return; } - else if (me->getVictim()->GetTypeId() == TYPEID_PLAYER - && me->getVictim()->GetHealth() * 10 < me->getVictim()->GetMaxHealth()) + + if (m_bIsDuelInProgress) { - me->getVictim()->CastSpell(me->getVictim(), 7267, true); // beg - me->getVictim()->RemoveGameObject(SPELL_DUEL_FLAG, true); - EnterEvadeMode(); - return; + if (lose) + { + if (!me->HasAura(7267)) + EnterEvadeMode(); + return; + } + else if (me->getVictim()->GetTypeId() == TYPEID_PLAYER + && me->getVictim()->GetHealth() * 10 < me->getVictim()->GetMaxHealth()) + { + me->getVictim()->CastSpell(me->getVictim(), 7267, true); // beg + me->getVictim()->RemoveGameObject(SPELL_DUEL_FLAG, true); + EnterEvadeMode(); + return; + } } - } - - // TODO: spells - - CombatAI::UpdateAI(uiDiff); - } -}; - -CreatureAI* GetAI_npc_death_knight_initiate(Creature* pCreature) -{ - return new npc_death_knight_initiateAI(pCreature); -} -bool GossipHello_npc_death_knight_initiate(Player* pPlayer, Creature* pCreature) -{ - if (pPlayer->GetQuestStatus(QUEST_DEATH_CHALLENGE) == QUEST_STATUS_INCOMPLETE && pCreature->GetHealth() == pCreature->GetMaxHealth()) - { - if (pPlayer->GetHealth() * 10 < pPlayer->GetMaxHealth()) - return true; - - if (pPlayer->isInCombat() || pCreature->isInCombat()) - return true; - - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ACCEPT_DUEL, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature),pCreature->GetGUID()); - } - return true; -} + // TODO: spells -bool GossipSelect_npc_death_knight_initiate(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF) - { - pPlayer->CLOSE_GOSSIP_MENU(); - - if (pPlayer->isInCombat() || pCreature->isInCombat()) - return true; - - if (npc_death_knight_initiateAI* pInitiateAI = CAST_AI(npc_death_knight_initiateAI, pCreature->AI())) - { - if (pInitiateAI->m_bIsDuelInProgress) - return true; + CombatAI::UpdateAI(uiDiff); } + }; + +}; - pCreature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); - pCreature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_15); - int32 uiSayId = rand()% (sizeof(m_auiRandomSay)/sizeof(int32)); - DoScriptText(m_auiRandomSay[uiSayId], pCreature, pPlayer); - pPlayer->CastSpell(pCreature, SPELL_DUEL, false); - pPlayer->CastSpell(pPlayer, SPELL_DUEL_FLAG, true); - } - return true; -} /*###### ## npc_dark_rider_of_acherus @@ -490,78 +519,85 @@ bool GossipSelect_npc_death_knight_initiate(Player* pPlayer, Creature* pCreature #define DESPAWN_HORSE 52267 #define SAY_DARK_RIDER "The realm of shadows awaits..." - -struct npc_dark_rider_of_acherusAI : public ScriptedAI +
class npc_dark_rider_of_acherus : public CreatureScript { - npc_dark_rider_of_acherusAI(Creature *c) : ScriptedAI(c) {} - - uint32 PhaseTimer; - uint32 Phase; - bool Intro; - uint64 TargetGUID; +public: + npc_dark_rider_of_acherus() : CreatureScript("npc_dark_rider_of_acherus") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - PhaseTimer = 4000; - Phase = 0; - Intro = false; - TargetGUID = 0; + return new npc_dark_rider_of_acherusAI(pCreature); } - void UpdateAI(const uint32 diff) + struct npc_dark_rider_of_acherusAI : public ScriptedAI { - if (!Intro || !TargetGUID) - return; + npc_dark_rider_of_acherusAI(Creature *c) : ScriptedAI(c) {} + + uint32 PhaseTimer; + uint32 Phase; + bool Intro; + uint64 TargetGUID; + + void Reset() + { + PhaseTimer = 4000; + Phase = 0; + Intro = false; + TargetGUID = 0; + } - if (PhaseTimer <= diff) + void UpdateAI(const uint32 diff) { - switch(Phase) + if (!Intro || !TargetGUID) + return; + + if (PhaseTimer <= diff) { - case 0: - me->MonsterSay(SAY_DARK_RIDER, LANG_UNIVERSAL, 0); - PhaseTimer = 5000; - Phase = 1; - break; - case 1: - if (Unit *pTarget = Unit::GetUnit(*me, TargetGUID)) - DoCast(pTarget, DESPAWN_HORSE, true); - PhaseTimer = 3000; - Phase = 2; - break; - case 2: - me->SetVisibility(VISIBILITY_OFF); - PhaseTimer = 2000; - Phase = 3; - break; - case 3: - me->ForcedDespawn(); - break; - default: - break; - } - } else PhaseTimer -= diff; + switch(Phase) + { + case 0: + me->MonsterSay(SAY_DARK_RIDER, LANG_UNIVERSAL, 0); + PhaseTimer = 5000; + Phase = 1; + break; + case 1: + if (Unit *pTarget = Unit::GetUnit(*me, TargetGUID)) + DoCast(pTarget, DESPAWN_HORSE, true); + PhaseTimer = 3000; + Phase = 2; + break; + case 2: + me->SetVisibility(VISIBILITY_OFF); + PhaseTimer = 2000; + Phase = 3; + break; + case 3: + me->ForcedDespawn(); + break; + default: + break; + } + } else PhaseTimer -= diff; - } + } - void InitDespawnHorse(Unit *who) - { - if (!who) - return; - - TargetGUID = who->GetGUID(); - me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); - me->SetSpeed(MOVE_RUN, 0.4f); - me->GetMotionMaster()->MoveChase(who); - me->SetUInt64Value(UNIT_FIELD_TARGET, TargetGUID); - Intro = true; - } + void InitDespawnHorse(Unit *who) + { + if (!who) + return; + + TargetGUID = who->GetGUID(); + me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + me->SetSpeed(MOVE_RUN, 0.4f); + me->GetMotionMaster()->MoveChase(who); + me->SetUInt64Value(UNIT_FIELD_TARGET, TargetGUID); + Intro = true; + } + + }; }; -CreatureAI* GetAI_npc_dark_rider_of_acherus(Creature* pCreature) -{ - return new npc_dark_rider_of_acherusAI(pCreature); -} /*###### ## npc_salanar_the_horseman @@ -575,222 +611,250 @@ enum eSalanar CALL_DARK_RIDER = 52266, SPELL_EFFECT_OVERTAKE = 52349 }; - -struct npc_salanar_the_horsemanAI : public ScriptedAI +
class npc_salanar_the_horseman : public CreatureScript { - npc_salanar_the_horsemanAI(Creature *c) : ScriptedAI(c) {} +public: + npc_salanar_the_horseman() : CreatureScript("npc_salanar_the_horseman") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_salanar_the_horsemanAI(pCreature); + } - void SpellHit(Unit *caster, const SpellEntry *spell) + struct npc_salanar_the_horsemanAI : public ScriptedAI { - if (spell->Id == DELIVER_STOLEN_HORSE) + npc_salanar_the_horsemanAI(Creature *c) : ScriptedAI(c) {} + + void SpellHit(Unit *caster, const SpellEntry *spell) { - if (caster->GetTypeId() == TYPEID_UNIT && caster->IsVehicle()) + if (spell->Id == DELIVER_STOLEN_HORSE) { - if (Unit *charmer = caster->GetCharmer()) + if (caster->GetTypeId() == TYPEID_UNIT && caster->IsVehicle()) { - charmer->RemoveAurasDueToSpell(EFFECT_STOLEN_HORSE); - caster->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK); - caster->setFaction(35); - DoCast(caster, CALL_DARK_RIDER, true); - if (Creature* Dark_Rider = me->FindNearestCreature(28654, 15)) - CAST_AI(npc_dark_rider_of_acherusAI, Dark_Rider->AI())->InitDespawnHorse(caster); + if (Unit *charmer = caster->GetCharmer()) + { + charmer->RemoveAurasDueToSpell(EFFECT_STOLEN_HORSE); + caster->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK); + caster->setFaction(35); + DoCast(caster, CALL_DARK_RIDER, true); + if (Creature* Dark_Rider = me->FindNearestCreature(28654, 15)) + CAST_AI(npc_dark_rider_of_acherus::npc_dark_rider_of_acherusAI, Dark_Rider->AI())->InitDespawnHorse(caster); + } } } } - } - - void MoveInLineOfSight(Unit *who) - { - ScriptedAI::MoveInLineOfSight(who); - if (who->GetTypeId() == TYPEID_UNIT && who->IsVehicle() && me->IsWithinDistInMap(who, 5.0f)) + void MoveInLineOfSight(Unit *who) { - if (Unit *charmer = who->GetCharmer()) + ScriptedAI::MoveInLineOfSight(who); + + if (who->GetTypeId() == TYPEID_UNIT && who->IsVehicle() && me->IsWithinDistInMap(who, 5.0f)) { - if (charmer->GetTypeId() == TYPEID_PLAYER) + if (Unit *charmer = who->GetCharmer()) { - // for quest Into the Realm of Shadows(12687) - if (me->GetEntry() == 28788 && CAST_PLR(charmer)->GetQuestStatus(12687) == QUEST_STATUS_INCOMPLETE) + if (charmer->GetTypeId() == TYPEID_PLAYER) { - CAST_PLR(charmer)->GroupEventHappens(12687, me); - charmer->RemoveAurasDueToSpell(SPELL_EFFECT_OVERTAKE); - CAST_CRE(who)->ForcedDespawn(); - //CAST_CRE(who)->Respawn(true); + // for quest Into the Realm of Shadows(12687) + if (me->GetEntry() == 28788 && CAST_PLR(charmer)->GetQuestStatus(12687) == QUEST_STATUS_INCOMPLETE) + { + CAST_PLR(charmer)->GroupEventHappens(12687, me); + charmer->RemoveAurasDueToSpell(SPELL_EFFECT_OVERTAKE); + CAST_CRE(who)->ForcedDespawn(); + //CAST_CRE(who)->Respawn(true); + } + + if (CAST_PLR(charmer)->HasAura(REALM_OF_SHADOWS)) + charmer->RemoveAurasDueToSpell(REALM_OF_SHADOWS); } - - if (CAST_PLR(charmer)->HasAura(REALM_OF_SHADOWS)) - charmer->RemoveAurasDueToSpell(REALM_OF_SHADOWS); } } } - } + }; + }; -CreatureAI* GetAI_npc_salanar_the_horseman(Creature* pCreature) -{ - return new npc_salanar_the_horsemanAI(pCreature); -} /*###### ## npc_ros_dark_rider ######*/ - -struct npc_ros_dark_riderAI : public ScriptedAI +
class npc_ros_dark_rider : public CreatureScript { - npc_ros_dark_riderAI(Creature *c) : ScriptedAI(c) {} +public: + npc_ros_dark_rider() : CreatureScript("npc_ros_dark_rider") { } - void EnterCombat(Unit * /*who*/) + CreatureAI* GetAI(Creature* pCreature) const { - me->ExitVehicle(); + return new npc_ros_dark_riderAI(pCreature); } - void Reset() + struct npc_ros_dark_riderAI : public ScriptedAI { - Creature* deathcharger = me->FindNearestCreature(28782, 30); - if (!deathcharger) return; - deathcharger->RestoreFaction(); - deathcharger->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK); - deathcharger->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - if (!me->GetVehicle() && deathcharger->IsVehicle() && deathcharger->GetVehicleKit()->HasEmptySeat(0)) - me->EnterVehicle(deathcharger); - } + npc_ros_dark_riderAI(Creature *c) : ScriptedAI(c) {} - void JustDied(Unit *killer) - { - Creature* deathcharger = me->FindNearestCreature(28782, 30); - if (!deathcharger) return; - if (killer->GetTypeId() == TYPEID_PLAYER && deathcharger->GetTypeId() == TYPEID_UNIT && deathcharger->IsVehicle()) + void EnterCombat(Unit * /*who*/) { - deathcharger->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK); - deathcharger->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - deathcharger->setFaction(2096); + me->ExitVehicle(); } - } + + void Reset() + { + Creature* deathcharger = me->FindNearestCreature(28782, 30); + if (!deathcharger) return; + deathcharger->RestoreFaction(); + deathcharger->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK); + deathcharger->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + if (!me->GetVehicle() && deathcharger->IsVehicle() && deathcharger->GetVehicleKit()->HasEmptySeat(0)) + me->EnterVehicle(deathcharger); + } + + void JustDied(Unit *killer) + { + Creature* deathcharger = me->FindNearestCreature(28782, 30); + if (!deathcharger) return; + if (killer->GetTypeId() == TYPEID_PLAYER && deathcharger->GetTypeId() == TYPEID_UNIT && deathcharger->IsVehicle()) + { + deathcharger->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK); + deathcharger->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + deathcharger->setFaction(2096); + } + } + }; + }; -CreatureAI* GetAI_npc_ros_dark_rider(Creature* pCreature) -{ - return new npc_ros_dark_riderAI(pCreature); -} // correct way: 52312 52314 52555 ... enum SG { GHOULS = 28845, GHOSTS = 28846, -}; -struct npc_dkc1_gothikAI : public ScriptedAI +};
class npc_dkc1_gothik : public CreatureScript { - npc_dkc1_gothikAI(Creature *c) : ScriptedAI(c) {} +public: + npc_dkc1_gothik() : CreatureScript("npc_dkc1_gothik") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_dkc1_gothikAI(pCreature); + } - void MoveInLineOfSight(Unit *who) + struct npc_dkc1_gothikAI : public ScriptedAI { - ScriptedAI::MoveInLineOfSight(who); + npc_dkc1_gothikAI(Creature *c) : ScriptedAI(c) {} - if (who->GetEntry() == GHOULS && me->IsWithinDistInMap(who, 10.0f)) + void MoveInLineOfSight(Unit *who) { - if (Unit *owner = who->GetOwner()) + ScriptedAI::MoveInLineOfSight(who); + + if (who->GetEntry() == GHOULS && me->IsWithinDistInMap(who, 10.0f)) { - if (owner->GetTypeId() == TYPEID_PLAYER) + if (Unit *owner = who->GetOwner()) { - if (CAST_PLR(owner)->GetQuestStatus(12698) == QUEST_STATUS_INCOMPLETE) + if (owner->GetTypeId() == TYPEID_PLAYER) { - //CAST_CRE(who)->CastSpell(owner, 52517, true); - CAST_PLR(owner)->KilledMonsterCredit(GHOULS, me->GetGUID()); - } - //Todo: Creatures must not be removed, but, must instead - // stand next to Gothik and be commanded into the pit - // and dig into the ground. - CAST_CRE(who)->ForcedDespawn(); + if (CAST_PLR(owner)->GetQuestStatus(12698) == QUEST_STATUS_INCOMPLETE) + { + //CAST_CRE(who)->CastSpell(owner, 52517, true); + CAST_PLR(owner)->KilledMonsterCredit(GHOULS, me->GetGUID()); + } + //Todo: Creatures must not be removed, but, must instead + // stand next to Gothik and be commanded into the pit + // and dig into the ground. + CAST_CRE(who)->ForcedDespawn(); - if (CAST_PLR(owner)->GetQuestStatus(12698) == QUEST_STATUS_COMPLETE) - owner->RemoveAllMinionsByEntry(GHOULS); + if (CAST_PLR(owner)->GetQuestStatus(12698) == QUEST_STATUS_COMPLETE) + owner->RemoveAllMinionsByEntry(GHOULS); + } } } } - } + }; + }; -CreatureAI* GetAI_npc_dkc1_gothik(Creature* pCreature) +
class npc_scarlet_ghoul : public CreatureScript { - return new npc_dkc1_gothikAI(pCreature); -} +public: + npc_scarlet_ghoul() : CreatureScript("npc_scarlet_ghoul") { } -struct npc_scarlet_ghoulAI : public ScriptedAI -{ - npc_scarlet_ghoulAI(Creature *c) : ScriptedAI(c) + CreatureAI* GetAI(Creature* pCreature) const { - // Ghouls should display their Birth Animation - // Crawling out of the ground - //DoCast(me, 35177, true); - //me->MonsterSay("Mommy?",LANG_UNIVERSAL,0); - me->SetReactState(REACT_DEFENSIVE); + return new npc_scarlet_ghoulAI(pCreature); } - void FindMinions(Unit *owner) + struct npc_scarlet_ghoulAI : public ScriptedAI { - std::list<Creature*> MinionList; - owner->GetAllMinionsByEntry(MinionList,GHOULS); + npc_scarlet_ghoulAI(Creature *c) : ScriptedAI(c) + { + // Ghouls should display their Birth Animation + // Crawling out of the ground + //DoCast(me, 35177, true); + //me->MonsterSay("Mommy?",LANG_UNIVERSAL,0); + me->SetReactState(REACT_DEFENSIVE); + } - if (!MinionList.empty()) + void FindMinions(Unit *owner) { - for (std::list<Creature*>::const_iterator itr = MinionList.begin(); itr != MinionList.end(); ++itr) + std::list<Creature*> MinionList; + owner->GetAllMinionsByEntry(MinionList,GHOULS); + + if (!MinionList.empty()) { - if (CAST_CRE(*itr)->GetOwner()->GetGUID() == me->GetOwner()->GetGUID()) + for (std::list<Creature*>::const_iterator itr = MinionList.begin(); itr != MinionList.end(); ++itr) { - if (CAST_CRE(*itr)->isInCombat() && CAST_CRE(*itr)->getAttackerForHelper()) + if (CAST_CRE(*itr)->GetOwner()->GetGUID() == me->GetOwner()->GetGUID()) { - AttackStart(CAST_CRE(*itr)->getAttackerForHelper()); + if (CAST_CRE(*itr)->isInCombat() && CAST_CRE(*itr)->getAttackerForHelper()) + { + AttackStart(CAST_CRE(*itr)->getAttackerForHelper()); + } } } } } - } - void UpdateAI(const uint32 /*diff*/) - { - if (!me->isInCombat()) + void UpdateAI(const uint32 /*diff*/) { - if (Unit *owner = me->GetOwner()) + if (!me->isInCombat()) { - if (owner->GetTypeId() == TYPEID_PLAYER && CAST_PLR(owner)->isInCombat()) + if (Unit *owner = me->GetOwner()) { - if (CAST_PLR(owner)->getAttackerForHelper() && CAST_PLR(owner)->getAttackerForHelper()->GetEntry() == GHOSTS) - { - AttackStart(CAST_PLR(owner)->getAttackerForHelper()); - } - else + if (owner->GetTypeId() == TYPEID_PLAYER && CAST_PLR(owner)->isInCombat()) { - FindMinions(owner); + if (CAST_PLR(owner)->getAttackerForHelper() && CAST_PLR(owner)->getAttackerForHelper()->GetEntry() == GHOSTS) + { + AttackStart(CAST_PLR(owner)->getAttackerForHelper()); + } + else + { + FindMinions(owner); + } } } } - } - if (!UpdateVictim()) - return; + if (!UpdateVictim()) + return; - //ScriptedAI::UpdateAI(diff); - //Check if we have a current target - if (me->getVictim()->GetEntry() == GHOSTS) - { - if (me->isAttackReady()) + //ScriptedAI::UpdateAI(diff); + //Check if we have a current target + if (me->getVictim()->GetEntry() == GHOSTS) { - //If we are within range melee the target - if (me->IsWithinMeleeRange(me->getVictim())) + if (me->isAttackReady()) { - me->AttackerStateUpdate(me->getVictim()); - me->resetAttackTimer(); + //If we are within range melee the target + if (me->IsWithinMeleeRange(me->getVictim())) + { + me->AttackerStateUpdate(me->getVictim()); + me->resetAttackTimer(); + } } } } - } + }; + }; -CreatureAI* GetAI_npc_scarlet_ghoul(Creature* pCreature) -{ - return new npc_scarlet_ghoulAI(pCreature); -} /*#### ## npc_scarlet_miner_cart @@ -798,46 +862,53 @@ CreatureAI* GetAI_npc_scarlet_ghoul(Creature* pCreature) #define SPELL_CART_CHECK 54173 #define SPELL_CART_DRAG 52465 - -struct npc_scarlet_miner_cartAI : public PassiveAI +
class npc_scarlet_miner_cart : public CreatureScript { - npc_scarlet_miner_cartAI(Creature *c) : PassiveAI(c), minerGUID(0) - { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); - me->SetDisplayId(me->GetCreatureInfo()->Modelid1); // H0 is horse - } - - uint64 minerGUID; +public: + npc_scarlet_miner_cart() : CreatureScript("npc_scarlet_miner_cart") { } - void SetGUID(const uint64 &guid, int32 /*id*/) + CreatureAI* GetAI(Creature *_Creature) { - minerGUID = guid; + return new npc_scarlet_miner_cartAI(_Creature); } - void DoAction(const int32 /*param*/) + struct npc_scarlet_miner_cartAI : public PassiveAI { - if (Creature *miner = Unit::GetCreature(*me, minerGUID)) + npc_scarlet_miner_cartAI(Creature *c) : PassiveAI(c), minerGUID(0) { - // very bad visual effect - me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - //me->SetSpeed(MOVE_WALK, miner->GetSpeed(MOVE_WALK)); - me->SetSpeed(MOVE_RUN, miner->GetSpeed(MOVE_RUN)); - me->GetMotionMaster()->MoveFollow(miner, 1.0f, 0); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->SetDisplayId(me->GetCreatureInfo()->Modelid1); // H0 is horse } - } - void PassengerBoarded(Unit * /*who*/, int8 /*seatId*/, bool apply) - { - if (!apply) + uint64 minerGUID; + + void SetGUID(const uint64 &guid, int32 /*id*/) + { + minerGUID = guid; + } + + void DoAction(const int32 /*param*/) + { if (Creature *miner = Unit::GetCreature(*me, minerGUID)) - miner->DisappearAndDie(); - } + { + // very bad visual effect + me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + //me->SetSpeed(MOVE_WALK, miner->GetSpeed(MOVE_WALK)); + me->SetSpeed(MOVE_RUN, miner->GetSpeed(MOVE_RUN)); + me->GetMotionMaster()->MoveFollow(miner, 1.0f, 0); + } + } + + void PassengerBoarded(Unit * /*who*/, int8 /*seatId*/, bool apply) + { + if (!apply) + if (Creature *miner = Unit::GetCreature(*me, minerGUID)) + miner->DisappearAndDie(); + } + }; + }; -CreatureAI* GetAI_npc_scarlet_miner_cart(Creature *_Creature) -{ - return new npc_scarlet_miner_cartAI(_Creature); -} /*#### ## npc_scarlet_miner @@ -845,234 +916,183 @@ CreatureAI* GetAI_npc_scarlet_miner_cart(Creature *_Creature) #define SAY_SCARLET_MINER1 "Where'd this come from? I better get this down to the ships before the foreman sees it!" #define SAY_SCARLET_MINER2 "Now I can have a rest!" - -struct npc_scarlet_minerAI : public npc_escortAI +
class npc_scarlet_miner : public CreatureScript { - npc_scarlet_minerAI(Creature *c) : npc_escortAI(c) - { - me->SetReactState(REACT_PASSIVE); - } - - uint32 IntroTimer; - uint32 IntroPhase; - uint64 carGUID; +public: + npc_scarlet_miner() : CreatureScript("npc_scarlet_miner") { } - void Reset() + CreatureAI* GetAI(Creature *_Creature) { - carGUID = 0; - IntroTimer = 0; - IntroPhase = 0; + return new npc_scarlet_minerAI(_Creature); } - void InitWaypoint() + struct npc_scarlet_minerAI : public npc_escortAI { - AddWaypoint(1, 2389.03, -5902.74, 109.014, 5000); - AddWaypoint(2, 2341.812012, -5900.484863, 102.619743); - AddWaypoint(3, 2306.561279, -5901.738281, 91.792419); - AddWaypoint(4, 2300.098389, -5912.618652, 86.014885); - AddWaypoint(5, 2294.142090, -5927.274414, 75.316849); - AddWaypoint(6, 2286.984375, -5944.955566, 63.714966); - AddWaypoint(7, 2280.001709, -5961.186035, 54.228283); - AddWaypoint(8, 2259.389648, -5974.197754, 42.359348); - AddWaypoint(9, 2242.882812, -5984.642578, 32.827850); - AddWaypoint(10, 2217.265625, -6028.959473, 7.675705); - AddWaypoint(11, 2202.595947, -6061.325684, 5.882018); - AddWaypoint(12, 2188.974609, -6080.866699, 3.370027); - - if (urand(0,1)) + npc_scarlet_minerAI(Creature *c) : npc_escortAI(c) { - AddWaypoint(13, 2176.483887, -6110.407227, 1.855181); - AddWaypoint(14, 2172.516602, -6146.752441, 1.074235); - AddWaypoint(15, 2138.918457, -6158.920898, 1.342926); - AddWaypoint(16, 2129.866699, -6174.107910, 4.380779); - AddWaypoint(17, 2117.709473, -6193.830078, 13.3542, 10000); + me->SetReactState(REACT_PASSIVE); } - else + + uint32 IntroTimer; + uint32 IntroPhase; + uint64 carGUID; + + void Reset() { - AddWaypoint(13, 2184.190186, -6166.447266, 0.968877); - AddWaypoint(14, 2234.265625, -6163.741211, 0.916021); - AddWaypoint(15, 2268.071777, -6158.750977, 1.822252); - AddWaypoint(16, 2270.028320, -6176.505859, 6.340538); - AddWaypoint(17, 2271.739014, -6195.401855, 13.3542, 10000); + carGUID = 0; + IntroTimer = 0; + IntroPhase = 0; } - } - void InitCartQuest(Player *who) - { - carGUID = who->GetVehicleBase()->GetGUID(); - InitWaypoint(); - Start(false, false, who->GetGUID()); - SetDespawnAtFar(false); - } + void InitWaypoint() + { + AddWaypoint(1, 2389.03, -5902.74, 109.014, 5000); + AddWaypoint(2, 2341.812012, -5900.484863, 102.619743); + AddWaypoint(3, 2306.561279, -5901.738281, 91.792419); + AddWaypoint(4, 2300.098389, -5912.618652, 86.014885); + AddWaypoint(5, 2294.142090, -5927.274414, 75.316849); + AddWaypoint(6, 2286.984375, -5944.955566, 63.714966); + AddWaypoint(7, 2280.001709, -5961.186035, 54.228283); + AddWaypoint(8, 2259.389648, -5974.197754, 42.359348); + AddWaypoint(9, 2242.882812, -5984.642578, 32.827850); + AddWaypoint(10, 2217.265625, -6028.959473, 7.675705); + AddWaypoint(11, 2202.595947, -6061.325684, 5.882018); + AddWaypoint(12, 2188.974609, -6080.866699, 3.370027); + + if (urand(0,1)) + { + AddWaypoint(13, 2176.483887, -6110.407227, 1.855181); + AddWaypoint(14, 2172.516602, -6146.752441, 1.074235); + AddWaypoint(15, 2138.918457, -6158.920898, 1.342926); + AddWaypoint(16, 2129.866699, -6174.107910, 4.380779); + AddWaypoint(17, 2117.709473, -6193.830078, 13.3542, 10000); + } + else + { + AddWaypoint(13, 2184.190186, -6166.447266, 0.968877); + AddWaypoint(14, 2234.265625, -6163.741211, 0.916021); + AddWaypoint(15, 2268.071777, -6158.750977, 1.822252); + AddWaypoint(16, 2270.028320, -6176.505859, 6.340538); + AddWaypoint(17, 2271.739014, -6195.401855, 13.3542, 10000); + } + } - void WaypointReached(uint32 i) - { - switch (i) + void InitCartQuest(Player *who) { - case 1: - if (Unit *car = Unit::GetCreature(*me, carGUID)) - { - me->SetInFront(car); - me->SendMovementFlagUpdate(); - } - me->MonsterSay(SAY_SCARLET_MINER1,LANG_UNIVERSAL,NULL); - SetRun(true); - IntroTimer = 4000; - IntroPhase = 1; - break; - case 17: - if (Unit *car = Unit::GetCreature(*me, carGUID)) - { - me->SetInFront(car); - me->SendMovementFlagUpdate(); - car->Relocate(car->GetPositionX(), car->GetPositionY(), me->GetPositionZ()); - car->SendMonsterStop(); - //this make player fall under ground, dunno why - //car->GetMotionMaster()->MovePoint(0, car->GetPositionX(), car->GetPositionY(), me->GetPositionZ()); - car->RemoveAura(SPELL_CART_DRAG); - } - me->MonsterSay(SAY_SCARLET_MINER2,LANG_UNIVERSAL,NULL); - break; - default: - break; + carGUID = who->GetVehicleBase()->GetGUID(); + InitWaypoint(); + Start(false, false, who->GetGUID()); + SetDespawnAtFar(false); } - } - void UpdateAI(const uint32 diff) - { - if (IntroPhase) + void WaypointReached(uint32 i) { - if (IntroTimer <= diff) + switch (i) { - if (IntroPhase == 1) - { - if (Creature *car = Unit::GetCreature(*me, carGUID)) - DoCast(car, SPELL_CART_DRAG); - IntroTimer = 800; - IntroPhase = 2; - } - else + case 1: + if (Unit *car = Unit::GetCreature(*me, carGUID)) + { + me->SetInFront(car); + me->SendMovementFlagUpdate(); + } + me->MonsterSay(SAY_SCARLET_MINER1,LANG_UNIVERSAL,NULL); + SetRun(true); + IntroTimer = 4000; + IntroPhase = 1; + break; + case 17: + if (Unit *car = Unit::GetCreature(*me, carGUID)) + { + me->SetInFront(car); + me->SendMovementFlagUpdate(); + car->Relocate(car->GetPositionX(), car->GetPositionY(), me->GetPositionZ()); + car->SendMonsterStop(); + //this make player fall under ground, dunno why + //car->GetMotionMaster()->MovePoint(0, car->GetPositionX(), car->GetPositionY(), me->GetPositionZ()); + car->RemoveAura(SPELL_CART_DRAG); + } + me->MonsterSay(SAY_SCARLET_MINER2,LANG_UNIVERSAL,NULL); + break; + default: + break; + } + } + + void UpdateAI(const uint32 diff) + { + if (IntroPhase) + { + if (IntroTimer <= diff) { - if (Creature *car = Unit::GetCreature(*me, carGUID)) - car->AI()->DoAction(); - IntroPhase = 0; - } - } else IntroTimer-=diff; + if (IntroPhase == 1) + { + if (Creature *car = Unit::GetCreature(*me, carGUID)) + DoCast(car, SPELL_CART_DRAG); + IntroTimer = 800; + IntroPhase = 2; + } + else + { + if (Creature *car = Unit::GetCreature(*me, carGUID)) + car->AI()->DoAction(); + IntroPhase = 0; + } + } else IntroTimer-=diff; + } + npc_escortAI::UpdateAI(diff); } - npc_escortAI::UpdateAI(diff); - } + }; + }; -CreatureAI* GetAI_npc_scarlet_miner(Creature *_Creature) -{ - return new npc_scarlet_minerAI(_Creature); -} /*###### ## go_inconspicuous_mine_car ######*/ #define SPELL_CART_SUMM 52463 - -bool GOHello_go_inconspicuous_mine_car(Player* pPlayer, GameObject* /*pGO*/) +
class go_inconspicuous_mine_car : public GameObjectScript { - if (pPlayer->GetQuestStatus(12701) == QUEST_STATUS_INCOMPLETE) +public: + go_inconspicuous_mine_car() : GameObjectScript("go_inconspicuous_mine_car") { } + + bool OnGossipHello(Player* pPlayer, GameObject* /*pGO*/) { - // Hack Why Trinity Dont Support Custom Summon Location - if (Creature *miner = pPlayer->SummonCreature(28841, 2383.869629, -5900.312500, 107.996086, pPlayer->GetOrientation(),TEMPSUMMON_DEAD_DESPAWN, 1)) + if (pPlayer->GetQuestStatus(12701) == QUEST_STATUS_INCOMPLETE) { - pPlayer->CastSpell(pPlayer, SPELL_CART_SUMM, true); - if (Creature *car = pPlayer->GetVehicleCreatureBase()) + // Hack Why Trinity Dont Support Custom Summon Location + if (Creature *miner = pPlayer->SummonCreature(28841, 2383.869629, -5900.312500, 107.996086, pPlayer->GetOrientation(),TEMPSUMMON_DEAD_DESPAWN, 1)) { - if (car->GetEntry() == 28817) + pPlayer->CastSpell(pPlayer, SPELL_CART_SUMM, true); + if (Creature *car = pPlayer->GetVehicleCreatureBase()) { - car->AI()->SetGUID(miner->GetGUID()); - CAST_AI(npc_scarlet_minerAI, miner->AI())->InitCartQuest(pPlayer); - } else sLog.outError("TSCR: GOHello_go_inconspicuous_mine_car vehicle entry is not correct."); - } else sLog.outError("TSCR: GOHello_go_inconspicuous_mine_car player is not on the vehicle."); - } else sLog.outError("TSCR: GOHello_go_inconspicuous_mine_car Scarlet Miner cant be found by script."); + if (car->GetEntry() == 28817) + { + car->AI()->SetGUID(miner->GetGUID()); + CAST_AI(npc_scarlet_miner::npc_scarlet_minerAI, miner->AI())->InitCartQuest(pPlayer); + } else sLog.outError("TSCR: OnGossipHello vehicle entry is not correct."); + } else sLog.outError("TSCR: OnGossipHello player is not on the vehicle."); + } else sLog.outError("TSCR: OnGossipHello Scarlet Miner cant be found by script."); + } + return true; } - return true; -} + +}; // npc 28912 quest 17217 boss 29001 mob 29007 go 191092 void AddSC_the_scarlet_enclave_c1() { - Script *newscript; - - // 12848 The Endless Hunger - newscript = new Script; - newscript->Name = "npc_unworthy_initiate"; - newscript->GetAI = &GetAI_npc_unworthy_initiate; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_unworthy_initiate_anchor"; - newscript->GetAI = &GetAI_npc_unworthy_initiate_anchor; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "go_acherus_soul_prison"; - newscript->pGOHello = &GOHello_go_acherus_soul_prison; - newscript->RegisterSelf(); - - // Death's Challenge - newscript = new Script; - newscript->Name = "npc_death_knight_initiate"; - newscript->GetAI = &GetAI_npc_death_knight_initiate; - newscript->pGossipHello = &GossipHello_npc_death_knight_initiate; - newscript->pGossipSelect = &GossipSelect_npc_death_knight_initiate; - newscript->RegisterSelf(); - - // 12680 Grand Theft Palomino - newscript = new Script; - newscript->Name = "npc_salanar_the_horseman"; - newscript->GetAI = &GetAI_npc_salanar_the_horseman; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_dark_rider_of_acherus"; - newscript->GetAI = &GetAI_npc_dark_rider_of_acherus; - newscript->RegisterSelf(); - - // 12687 Into the Realm of Shadows - newscript = new Script; - newscript->Name = "npc_ros_dark_rider"; - newscript->GetAI = &GetAI_npc_ros_dark_rider; - newscript->RegisterSelf(); - - // 12698 The Gift That Keeps On Giving - newscript = new Script; - newscript->Name = "npc_dkc1_gothik"; - newscript->GetAI = &GetAI_npc_dkc1_gothik; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_scarlet_ghoul"; - newscript->GetAI = &GetAI_npc_scarlet_ghoul; - newscript->RegisterSelf(); - - // Massacre At Light's Point - newscript = new Script; - newscript->Name = "npc_scarlet_miner"; - newscript->GetAI = &GetAI_npc_scarlet_miner; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_scarlet_miner_cart"; - newscript->GetAI = &GetAI_npc_scarlet_miner_cart; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "go_inconspicuous_mine_car"; - newscript->pGOHello = &GOHello_go_inconspicuous_mine_car; - newscript->RegisterSelf(); + new npc_unworthy_initiate(); + new npc_unworthy_initiate_anchor(); + new go_acherus_soul_prison(); + new npc_death_knight_initiate(); + new npc_salanar_the_horseman(); + new npc_dark_rider_of_acherus(); + new npc_ros_dark_rider(); + new npc_dkc1_gothik(); + new npc_scarlet_ghoul(); + new npc_scarlet_miner(); + new npc_scarlet_miner_cart(); + new go_inconspicuous_mine_car(); } - -/* -DELETE FROM `script_texts` WHERE `entry` IN(-1609301, -1609302); -INSERT INTO `script_texts` (`entry`,`content_default`,`type`,`language`,`emote`,`comment`) VALUES -(-1609301, 'Come, weakling! Strike me down!', 0, 0, 0, 'SAY_DEATH_RIDER_FINAL'), -(-1609302, '%s rears up, beckoning you to ride it.', 2, 0, 0, 'SAY_DEATH_CHARGER'); -*/ diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp index 4f8729bacf4..d7a7942fd3b 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp @@ -43,96 +43,103 @@ enum win_friends SAY_PERSUADED6 = -1609519, SPELL_PERSUASIVE_STRIKE = 52781 }; - -struct npc_crusade_persuadedAI : public ScriptedAI +
class npc_crusade_persuaded : public CreatureScript { - npc_crusade_persuadedAI(Creature *pCreature) : ScriptedAI(pCreature) {} - - uint32 uiSpeech_timer; - uint32 uiSpeech_counter; - uint64 uiPlayerGUID; +public: + npc_crusade_persuaded() : CreatureScript("npc_crusade_persuaded") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - uiSpeech_timer = 0; - uiSpeech_counter = 0; - uiPlayerGUID = 0; - me->SetReactState(REACT_AGGRESSIVE); - me->RestoreFaction(); + return new npc_crusade_persuadedAI (pCreature); } - void SpellHit(Unit *caster, const SpellEntry *spell) + struct npc_crusade_persuadedAI : public ScriptedAI { - if (spell->Id == SPELL_PERSUASIVE_STRIKE && caster->GetTypeId() == TYPEID_PLAYER && me->isAlive() && !uiSpeech_counter) + npc_crusade_persuadedAI(Creature *pCreature) : ScriptedAI(pCreature) {} + + uint32 uiSpeech_timer; + uint32 uiSpeech_counter; + uint64 uiPlayerGUID; + + void Reset() { - if (CAST_PLR(caster)->GetQuestStatus(12720) == QUEST_STATUS_INCOMPLETE) - { - uiPlayerGUID = caster->GetGUID(); - uiSpeech_timer = 1000; - uiSpeech_counter = 1; - me->setFaction(caster->getFaction()); - me->CombatStop(true); - me->GetMotionMaster()->MoveIdle(); - me->SetReactState(REACT_PASSIVE); - DoCastAOE(58111, true); - - DoScriptText(RAND(SAY_PERSUADE1,SAY_PERSUADE2,SAY_PERSUADE3, - SAY_PERSUADE4,SAY_PERSUADE5,SAY_PERSUADE6, - SAY_PERSUADE7), caster); - - DoScriptText(RAND(SAY_CRUSADER1,SAY_CRUSADER2,SAY_CRUSADER3, - SAY_CRUSADER4,SAY_CRUSADER5,SAY_CRUSADER6), me); - } + uiSpeech_timer = 0; + uiSpeech_counter = 0; + uiPlayerGUID = 0; + me->SetReactState(REACT_AGGRESSIVE); + me->RestoreFaction(); } - } - void UpdateAI(const uint32 diff) - { - if (uiSpeech_counter) + void SpellHit(Unit *caster, const SpellEntry *spell) { - if (uiSpeech_timer <= diff) + if (spell->Id == SPELL_PERSUASIVE_STRIKE && caster->GetTypeId() == TYPEID_PLAYER && me->isAlive() && !uiSpeech_counter) { - Player* pPlayer = Unit::GetPlayer(*me, uiPlayerGUID); - if (!pPlayer) + if (CAST_PLR(caster)->GetQuestStatus(12720) == QUEST_STATUS_INCOMPLETE) { - EnterEvadeMode(); - return; + uiPlayerGUID = caster->GetGUID(); + uiSpeech_timer = 1000; + uiSpeech_counter = 1; + me->setFaction(caster->getFaction()); + me->CombatStop(true); + me->GetMotionMaster()->MoveIdle(); + me->SetReactState(REACT_PASSIVE); + DoCastAOE(58111, true); + + DoScriptText(RAND(SAY_PERSUADE1,SAY_PERSUADE2,SAY_PERSUADE3, + SAY_PERSUADE4,SAY_PERSUADE5,SAY_PERSUADE6, + SAY_PERSUADE7), caster); + + DoScriptText(RAND(SAY_CRUSADER1,SAY_CRUSADER2,SAY_CRUSADER3, + SAY_CRUSADER4,SAY_CRUSADER5,SAY_CRUSADER6), me); } + } + } - switch(uiSpeech_counter) + void UpdateAI(const uint32 diff) + { + if (uiSpeech_counter) + { + if (uiSpeech_timer <= diff) { - case 1: DoScriptText(SAY_PERSUADED1, me); uiSpeech_timer = 8000; break; - case 2: DoScriptText(SAY_PERSUADED2, me); uiSpeech_timer = 8000; break; - case 3: DoScriptText(SAY_PERSUADED3, me); uiSpeech_timer = 8000; break; - case 4: DoScriptText(SAY_PERSUADED4, me); uiSpeech_timer = 8000; break; - case 5: DoScriptText(SAY_PERSUADED5, pPlayer); uiSpeech_timer = 8000; break; - case 6: DoScriptText(SAY_PERSUADED6, me); - pPlayer->Kill(me); - //me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - //me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - uiSpeech_counter = 0; - pPlayer->GroupEventHappens(12720, me); + Player* pPlayer = Unit::GetPlayer(*me, uiPlayerGUID); + if (!pPlayer) + { + EnterEvadeMode(); return; - } + } - ++uiSpeech_counter; - DoCastAOE(58111, true); - } else uiSpeech_timer -= diff; + switch(uiSpeech_counter) + { + case 1: DoScriptText(SAY_PERSUADED1, me); uiSpeech_timer = 8000; break; + case 2: DoScriptText(SAY_PERSUADED2, me); uiSpeech_timer = 8000; break; + case 3: DoScriptText(SAY_PERSUADED3, me); uiSpeech_timer = 8000; break; + case 4: DoScriptText(SAY_PERSUADED4, me); uiSpeech_timer = 8000; break; + case 5: DoScriptText(SAY_PERSUADED5, pPlayer); uiSpeech_timer = 8000; break; + case 6: DoScriptText(SAY_PERSUADED6, me); + pPlayer->Kill(me); + //me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + //me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + uiSpeech_counter = 0; + pPlayer->GroupEventHappens(12720, me); + return; + } - return; - } + ++uiSpeech_counter; + DoCastAOE(58111, true); + } else uiSpeech_timer -= diff; - if (!UpdateVictim()) - return; + return; + } + + if (!UpdateVictim()) + return; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_npc_crusade_persuaded(Creature* pCreature) -{ - return new npc_crusade_persuadedAI (pCreature); -} /*###### ## npc_koltira_deathweaver @@ -164,168 +171,176 @@ enum eKoltira //NPC_DEATH_KNIGHT_MOUNT = 29201, MODEL_DEATH_KNIGHT_MOUNT = 25278 }; - -struct npc_koltira_deathweaverAI : public npc_escortAI +
class npc_koltira_deathweaver : public CreatureScript { - npc_koltira_deathweaverAI(Creature *pCreature) : npc_escortAI(pCreature) +public: + npc_koltira_deathweaver() : CreatureScript("npc_koltira_deathweaver") { } + + bool OnQuestAccept(Player* pPlayer, Creature* pCreature, const Quest* pQuest) { - me->SetReactState(REACT_DEFENSIVE); + if (pQuest->GetQuestId() == QUEST_BREAKOUT) + { + pCreature->SetStandState(UNIT_STAND_STATE_STAND); + + if (npc_escortAI* pEscortAI = CAST_AI(npc_koltira_deathweaver::npc_koltira_deathweaverAI,pCreature->AI())) + pEscortAI->Start(false, false, pPlayer->GetGUID()); + } + return true; } - uint32 m_uiWave; - uint32 m_uiWave_Timer; - uint64 m_uiValrothGUID; + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_koltira_deathweaverAI(pCreature); + } - void Reset() + struct npc_koltira_deathweaverAI : public npc_escortAI { - if (!HasEscortState(STATE_ESCORT_ESCORTING)) + npc_koltira_deathweaverAI(Creature *pCreature) : npc_escortAI(pCreature) { - m_uiWave = 0; - m_uiWave_Timer = 3000; - m_uiValrothGUID = 0; - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->LoadEquipment(0, true); - me->RemoveAura(SPELL_ANTI_MAGIC_ZONE); + me->SetReactState(REACT_DEFENSIVE); } - } - void WaypointReached(uint32 uiPointId) - { - switch(uiPointId) + uint32 m_uiWave; + uint32 m_uiWave_Timer; + uint64 m_uiValrothGUID; + + void Reset() { - case 0: - DoScriptText(SAY_BREAKOUT1, me); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - break; - case 1: - me->SetStandState(UNIT_STAND_STATE_KNEEL); - break; - case 2: - me->SetStandState(UNIT_STAND_STATE_STAND); - //me->UpdateEntry(NPC_KOLTIRA_ALT); //unclear if we must update or not - DoCast(me, SPELL_KOLTIRA_TRANSFORM); - me->LoadEquipment(me->GetEquipmentId()); - break; - case 3: - SetEscortPaused(true); - me->SetStandState(UNIT_STAND_STATE_KNEEL); - DoScriptText(SAY_BREAKOUT2, me); - DoCast(me, SPELL_ANTI_MAGIC_ZONE); // cast again that makes bubble up - break; - case 4: - SetRun(true); - break; - case 9: - me->Mount(MODEL_DEATH_KNIGHT_MOUNT); - break; - case 10: - me->Unmount(); - break; + if (!HasEscortState(STATE_ESCORT_ESCORTING)) + { + m_uiWave = 0; + m_uiWave_Timer = 3000; + m_uiValrothGUID = 0; + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->LoadEquipment(0, true); + me->RemoveAura(SPELL_ANTI_MAGIC_ZONE); + } } - } - void JustSummoned(Creature* pSummoned) - { - if (Player* pPlayer = GetPlayerForEscort()) + void WaypointReached(uint32 uiPointId) { - pSummoned->AI()->AttackStart(pPlayer); + switch(uiPointId) + { + case 0: + DoScriptText(SAY_BREAKOUT1, me); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + break; + case 1: + me->SetStandState(UNIT_STAND_STATE_KNEEL); + break; + case 2: + me->SetStandState(UNIT_STAND_STATE_STAND); + //me->UpdateEntry(NPC_KOLTIRA_ALT); //unclear if we must update or not + DoCast(me, SPELL_KOLTIRA_TRANSFORM); + me->LoadEquipment(me->GetEquipmentId()); + break; + case 3: + SetEscortPaused(true); + me->SetStandState(UNIT_STAND_STATE_KNEEL); + DoScriptText(SAY_BREAKOUT2, me); + DoCast(me, SPELL_ANTI_MAGIC_ZONE); // cast again that makes bubble up + break; + case 4: + SetRun(true); + break; + case 9: + me->Mount(MODEL_DEATH_KNIGHT_MOUNT); + break; + case 10: + me->Unmount(); + break; + } } - if (pSummoned->GetEntry() == NPC_HIGH_INQUISITOR_VALROTH) - m_uiValrothGUID = pSummoned->GetGUID(); + void JustSummoned(Creature* pSummoned) + { + if (Player* pPlayer = GetPlayerForEscort()) + { + pSummoned->AI()->AttackStart(pPlayer); + } - pSummoned->AddThreat(me, 0.0f); - pSummoned->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); - } + if (pSummoned->GetEntry() == NPC_HIGH_INQUISITOR_VALROTH) + m_uiValrothGUID = pSummoned->GetGUID(); - void SummonAcolyte(uint32 uiAmount) - { - for (uint32 i = 0; i < uiAmount; ++i) - me->SummonCreature(NPC_CRIMSON_ACOLYTE, 1642.329, -6045.818, 127.583, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); - } + pSummoned->AddThreat(me, 0.0f); + pSummoned->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + } - void UpdateAI(const uint32 uiDiff) - { - npc_escortAI::UpdateAI(uiDiff); + void SummonAcolyte(uint32 uiAmount) + { + for (uint32 i = 0; i < uiAmount; ++i) + me->SummonCreature(NPC_CRIMSON_ACOLYTE, 1642.329, -6045.818, 127.583, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); + } - if (HasEscortState(STATE_ESCORT_PAUSED)) + void UpdateAI(const uint32 uiDiff) { - if (m_uiWave_Timer <= uiDiff) + npc_escortAI::UpdateAI(uiDiff); + + if (HasEscortState(STATE_ESCORT_PAUSED)) { - switch(m_uiWave) + if (m_uiWave_Timer <= uiDiff) { - case 0: - DoScriptText(SAY_BREAKOUT3, me); - SummonAcolyte(3); - m_uiWave_Timer = 20000; - break; - case 1: - DoScriptText(SAY_BREAKOUT4, me); - SummonAcolyte(3); - m_uiWave_Timer = 20000; - break; - case 2: - DoScriptText(SAY_BREAKOUT5, me); - SummonAcolyte(4); - m_uiWave_Timer = 20000; - break; - case 3: - DoScriptText(SAY_BREAKOUT6, me); - me->SummonCreature(NPC_HIGH_INQUISITOR_VALROTH, 1642.329, -6045.818, 127.583, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 1000); - m_uiWave_Timer = 1000; - break; - case 4: + switch(m_uiWave) { - Creature* pTemp = Unit::GetCreature(*me, m_uiValrothGUID); - - if (!pTemp || !pTemp->isAlive()) + case 0: + DoScriptText(SAY_BREAKOUT3, me); + SummonAcolyte(3); + m_uiWave_Timer = 20000; + break; + case 1: + DoScriptText(SAY_BREAKOUT4, me); + SummonAcolyte(3); + m_uiWave_Timer = 20000; + break; + case 2: + DoScriptText(SAY_BREAKOUT5, me); + SummonAcolyte(4); + m_uiWave_Timer = 20000; + break; + case 3: + DoScriptText(SAY_BREAKOUT6, me); + me->SummonCreature(NPC_HIGH_INQUISITOR_VALROTH, 1642.329, -6045.818, 127.583, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 1000); + m_uiWave_Timer = 1000; + break; + case 4: { - DoScriptText(SAY_BREAKOUT8, me); - m_uiWave_Timer = 5000; + Creature* pTemp = Unit::GetCreature(*me, m_uiValrothGUID); + + if (!pTemp || !pTemp->isAlive()) + { + DoScriptText(SAY_BREAKOUT8, me); + m_uiWave_Timer = 5000; + } + else + { + m_uiWave_Timer = 2500; + return; //return, we don't want m_uiWave to increment now + } + break; } - else - { + case 5: + DoScriptText(SAY_BREAKOUT9, me); + me->RemoveAurasDueToSpell(SPELL_ANTI_MAGIC_ZONE); + // i do not know why the armor will also be removed m_uiWave_Timer = 2500; - return; //return, we don't want m_uiWave to increment now - } - break; + break; + case 6: + DoScriptText(SAY_BREAKOUT10, me); + SetEscortPaused(false); + break; } - case 5: - DoScriptText(SAY_BREAKOUT9, me); - me->RemoveAurasDueToSpell(SPELL_ANTI_MAGIC_ZONE); - // i do not know why the armor will also be removed - m_uiWave_Timer = 2500; - break; - case 6: - DoScriptText(SAY_BREAKOUT10, me); - SetEscortPaused(false); - break; - } - ++m_uiWave; + ++m_uiWave; + } + else + m_uiWave_Timer -= uiDiff; } - else - m_uiWave_Timer -= uiDiff; } - } + }; + }; -CreatureAI* GetAI_npc_koltira_deathweaver(Creature* pCreature) -{ - return new npc_koltira_deathweaverAI(pCreature); -} -bool QuestAccept_npc_koltira_deathweaver(Player* pPlayer, Creature* pCreature, const Quest* pQuest) -{ - if (pQuest->GetQuestId() == QUEST_BREAKOUT) - { - pCreature->SetStandState(UNIT_STAND_STATE_STAND); - - if (npc_escortAI* pEscortAI = CAST_AI(npc_koltira_deathweaverAI,pCreature->AI())) - pEscortAI->Start(false, false, pPlayer->GetGUID()); - } - return true; -} //Scarlet courier enum ScarletCourierEnum @@ -336,77 +351,84 @@ enum ScarletCourierEnum GO_INCONSPICUOUS_TREE = 191144, NPC_SCARLET_COURIER = 29076 }; - -struct mob_scarlet_courierAI : public ScriptedAI +
class mob_scarlet_courier : public CreatureScript { - mob_scarlet_courierAI(Creature *pCreature) : ScriptedAI(pCreature) {} - - uint32 uiStage; - uint32 uiStage_timer; +public: + mob_scarlet_courier() : CreatureScript("mob_scarlet_courier") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - me->Mount(14338); // not sure about this id - uiStage = 1; - uiStage_timer = 3000; + return new mob_scarlet_courierAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct mob_scarlet_courierAI : public ScriptedAI { - DoScriptText(SAY_TREE2, me); - me->Unmount(); - uiStage = 0; - } + mob_scarlet_courierAI(Creature *pCreature) : ScriptedAI(pCreature) {} - void MovementInform(uint32 type, uint32 id) - { - if (type != POINT_MOTION_TYPE) - return; + uint32 uiStage; + uint32 uiStage_timer; - if (id == 1) - uiStage = 2; - } + void Reset() + { + me->Mount(14338); // not sure about this id + uiStage = 1; + uiStage_timer = 3000; + } - void UpdateAI(const uint32 diff) - { - if (uiStage && !me->isInCombat()) + void EnterCombat(Unit * /*who*/) { - if (uiStage_timer <= diff) + DoScriptText(SAY_TREE2, me); + me->Unmount(); + uiStage = 0; + } + + void MovementInform(uint32 type, uint32 id) + { + if (type != POINT_MOTION_TYPE) + return; + + if (id == 1) + uiStage = 2; + } + + void UpdateAI(const uint32 diff) + { + if (uiStage && !me->isInCombat()) { - switch(uiStage) + if (uiStage_timer <= diff) { - case 1: - me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); - if (GameObject* tree = me->FindNearestGameObject(GO_INCONSPICUOUS_TREE, 40.0f)) + switch(uiStage) { - DoScriptText(SAY_TREE1, me); - float x, y, z; - tree->GetContactPoint(me, x, y, z); - me->GetMotionMaster()->MovePoint(1, x, y, z); + case 1: + me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + if (GameObject* tree = me->FindNearestGameObject(GO_INCONSPICUOUS_TREE, 40.0f)) + { + DoScriptText(SAY_TREE1, me); + float x, y, z; + tree->GetContactPoint(me, x, y, z); + me->GetMotionMaster()->MovePoint(1, x, y, z); + } + break; + case 2: + if (GameObject* tree = me->FindNearestGameObject(GO_INCONSPICUOUS_TREE, 40.0f)) + if (Unit *unit = tree->GetOwner()) + AttackStart(unit); + break; } - break; - case 2: - if (GameObject* tree = me->FindNearestGameObject(GO_INCONSPICUOUS_TREE, 40.0f)) - if (Unit *unit = tree->GetOwner()) - AttackStart(unit); - break; - } - uiStage_timer = 3000; - uiStage = 0; - } else uiStage_timer -= diff; - } + uiStage_timer = 3000; + uiStage = 0; + } else uiStage_timer -= diff; + } - if (!UpdateVictim()) - return; + if (!UpdateVictim()) + return; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_mob_scarlet_courier(Creature* pCreature) -{ - return new mob_scarlet_courierAI (pCreature); -} //Koltira & Valroth- Breakout @@ -423,71 +445,78 @@ enum valroth SPELL_VALROTH_SMITE = 52926, SPELL_SUMMON_VALROTH_REMAINS = 52929 }; - -struct mob_high_inquisitor_valrothAI : public ScriptedAI +
class mob_high_inquisitor_valroth : public CreatureScript { - mob_high_inquisitor_valrothAI(Creature *pCreature) : ScriptedAI(pCreature) {} +public: + mob_high_inquisitor_valroth() : CreatureScript("mob_high_inquisitor_valroth") { } - uint32 uiRenew_timer; - uint32 uiInquisitor_Penance_timer; - uint32 uiValroth_Smite_timer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - uiRenew_timer = 1000; - uiInquisitor_Penance_timer = 2000; - uiValroth_Smite_timer = 1000; + return new mob_high_inquisitor_valrothAI (pCreature); } - void EnterCombat(Unit* who) + struct mob_high_inquisitor_valrothAI : public ScriptedAI { - DoScriptText(SAY_VALROTH2, me); - DoCast(who, SPELL_VALROTH_SMITE); - } + mob_high_inquisitor_valrothAI(Creature *pCreature) : ScriptedAI(pCreature) {} - void UpdateAI(const uint32 diff) - { - if (uiRenew_timer <= diff) + uint32 uiRenew_timer; + uint32 uiInquisitor_Penance_timer; + uint32 uiValroth_Smite_timer; + + void Reset() { - Shout(); - DoCast(me, SPELL_RENEW); - uiRenew_timer = 1000 + rand()%5000; - } else uiRenew_timer -= diff; + uiRenew_timer = 1000; + uiInquisitor_Penance_timer = 2000; + uiValroth_Smite_timer = 1000; + } - if (uiInquisitor_Penance_timer <= diff) + void EnterCombat(Unit* who) { - Shout(); - DoCast(me->getVictim(), SPELL_INQUISITOR_PENANCE); - uiInquisitor_Penance_timer = 2000 + rand()%5000; - } else uiInquisitor_Penance_timer -= diff; + DoScriptText(SAY_VALROTH2, me); + DoCast(who, SPELL_VALROTH_SMITE); + } - if (uiValroth_Smite_timer <= diff) + void UpdateAI(const uint32 diff) { - Shout(); - DoCast(me->getVictim(), SPELL_VALROTH_SMITE); - uiValroth_Smite_timer = 1000 + rand()%5000; - } else uiValroth_Smite_timer -= diff; + if (uiRenew_timer <= diff) + { + Shout(); + DoCast(me, SPELL_RENEW); + uiRenew_timer = 1000 + rand()%5000; + } else uiRenew_timer -= diff; - DoMeleeAttackIfReady(); - } + if (uiInquisitor_Penance_timer <= diff) + { + Shout(); + DoCast(me->getVictim(), SPELL_INQUISITOR_PENANCE); + uiInquisitor_Penance_timer = 2000 + rand()%5000; + } else uiInquisitor_Penance_timer -= diff; - void Shout() - { - if (rand()%100 < 15) - DoScriptText(RAND(SAY_VALROTH3,SAY_VALROTH4,SAY_VALROTH5), me); - } + if (uiValroth_Smite_timer <= diff) + { + Shout(); + DoCast(me->getVictim(), SPELL_VALROTH_SMITE); + uiValroth_Smite_timer = 1000 + rand()%5000; + } else uiValroth_Smite_timer -= diff; + + DoMeleeAttackIfReady(); + } + + void Shout() + { + if (rand()%100 < 15) + DoScriptText(RAND(SAY_VALROTH3,SAY_VALROTH4,SAY_VALROTH5), me); + } + + void JustDied(Unit* killer) + { + DoScriptText(SAY_VALROTH6, me); + killer->CastSpell(me, SPELL_SUMMON_VALROTH_REMAINS, true); + } + }; - void JustDied(Unit* killer) - { - DoScriptText(SAY_VALROTH6, me); - killer->CastSpell(me, SPELL_SUMMON_VALROTH_REMAINS, true); - } }; -CreatureAI* GetAI_mob_high_inquisitor_valroth(Creature* pCreature) -{ - return new mob_high_inquisitor_valrothAI (pCreature); -} /*###### ## npc_a_special_surprise @@ -552,443 +581,412 @@ enum SpecialSurprise NPC_PLAGUEFIST = 29053 }; - -struct npc_a_special_surpriseAI : public ScriptedAI +
class npc_a_special_surprise : public CreatureScript { - npc_a_special_surpriseAI(Creature *pCreature) : ScriptedAI(pCreature) {} - - uint32 ExecuteSpeech_Timer; - uint32 ExecuteSpeech_Counter; - uint64 PlayerGUID; +public: + npc_a_special_surprise() : CreatureScript("npc_a_special_surprise") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - ExecuteSpeech_Timer = 0; - ExecuteSpeech_Counter = 0; - PlayerGUID = 0; - - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + return new npc_a_special_surpriseAI(pCreature); } - bool MeetQuestCondition(Unit* pPlayer) + struct npc_a_special_surpriseAI : public ScriptedAI { - switch(me->GetEntry()) + npc_a_special_surpriseAI(Creature *pCreature) : ScriptedAI(pCreature) {} + + uint32 ExecuteSpeech_Timer; + uint32 ExecuteSpeech_Counter; + uint64 PlayerGUID; + + void Reset() { - case 29061: // Ellen Stanbridge - if (CAST_PLR(pPlayer)->GetQuestStatus(12742) == QUEST_STATUS_INCOMPLETE) - return true; - break; - case 29072: // Kug Ironjaw - if (CAST_PLR(pPlayer)->GetQuestStatus(12748) == QUEST_STATUS_INCOMPLETE) - return true; - break; - case 29067: // Donovan Pulfrost - if (CAST_PLR(pPlayer)->GetQuestStatus(12744) == QUEST_STATUS_INCOMPLETE) - return true; - break; - case 29065: // Yazmina Oakenthorn - if (CAST_PLR(pPlayer)->GetQuestStatus(12743) == QUEST_STATUS_INCOMPLETE) - return true; - break; - case 29071: // Antoine Brack - if (CAST_PLR(pPlayer)->GetQuestStatus(12750) == QUEST_STATUS_INCOMPLETE) - return true; - break; - case 29032: // Malar Bravehorn - if (CAST_PLR(pPlayer)->GetQuestStatus(12739) == QUEST_STATUS_INCOMPLETE) - return true; - break; - case 29068: // Goby Blastenheimer - if (CAST_PLR(pPlayer)->GetQuestStatus(12745) == QUEST_STATUS_INCOMPLETE) - return true; - break; - case 29073: // Iggy Darktusk - if (CAST_PLR(pPlayer)->GetQuestStatus(12749) == QUEST_STATUS_INCOMPLETE) - return true; - break; - case 29074: // Lady Eonys - if (CAST_PLR(pPlayer)->GetQuestStatus(12747) == QUEST_STATUS_INCOMPLETE) - return true; - break; - case 29070: // Valok the Righteous - if (CAST_PLR(pPlayer)->GetQuestStatus(12746) == QUEST_STATUS_INCOMPLETE) - return true; - break; + ExecuteSpeech_Timer = 0; + ExecuteSpeech_Counter = 0; + PlayerGUID = 0; + + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); } - return false; - } + bool MeetQuestCondition(Unit* pPlayer) + { + switch(me->GetEntry()) + { + case 29061: // Ellen Stanbridge + if (CAST_PLR(pPlayer)->GetQuestStatus(12742) == QUEST_STATUS_INCOMPLETE) + return true; + break; + case 29072: // Kug Ironjaw + if (CAST_PLR(pPlayer)->GetQuestStatus(12748) == QUEST_STATUS_INCOMPLETE) + return true; + break; + case 29067: // Donovan Pulfrost + if (CAST_PLR(pPlayer)->GetQuestStatus(12744) == QUEST_STATUS_INCOMPLETE) + return true; + break; + case 29065: // Yazmina Oakenthorn + if (CAST_PLR(pPlayer)->GetQuestStatus(12743) == QUEST_STATUS_INCOMPLETE) + return true; + break; + case 29071: // Antoine Brack + if (CAST_PLR(pPlayer)->GetQuestStatus(12750) == QUEST_STATUS_INCOMPLETE) + return true; + break; + case 29032: // Malar Bravehorn + if (CAST_PLR(pPlayer)->GetQuestStatus(12739) == QUEST_STATUS_INCOMPLETE) + return true; + break; + case 29068: // Goby Blastenheimer + if (CAST_PLR(pPlayer)->GetQuestStatus(12745) == QUEST_STATUS_INCOMPLETE) + return true; + break; + case 29073: // Iggy Darktusk + if (CAST_PLR(pPlayer)->GetQuestStatus(12749) == QUEST_STATUS_INCOMPLETE) + return true; + break; + case 29074: // Lady Eonys + if (CAST_PLR(pPlayer)->GetQuestStatus(12747) == QUEST_STATUS_INCOMPLETE) + return true; + break; + case 29070: // Valok the Righteous + if (CAST_PLR(pPlayer)->GetQuestStatus(12746) == QUEST_STATUS_INCOMPLETE) + return true; + break; + } - void MoveInLineOfSight(Unit* pWho) - { - if (PlayerGUID || pWho->GetTypeId() != TYPEID_PLAYER || !pWho->IsWithinDist(me, INTERACTION_DISTANCE)) - return; + return false; + } - if (MeetQuestCondition(pWho)) - PlayerGUID = pWho->GetGUID(); - } + void MoveInLineOfSight(Unit* pWho) + { + if (PlayerGUID || pWho->GetTypeId() != TYPEID_PLAYER || !pWho->IsWithinDist(me, INTERACTION_DISTANCE)) + return; - void UpdateAI(const uint32 diff) - { - if (PlayerGUID && !me->getVictim() && me->isAlive()) + if (MeetQuestCondition(pWho)) + PlayerGUID = pWho->GetGUID(); + } + + void UpdateAI(const uint32 diff) { - if (ExecuteSpeech_Timer <= diff) + if (PlayerGUID && !me->getVictim() && me->isAlive()) { - Player* pPlayer = Unit::GetPlayer(*me, PlayerGUID); - - if (!pPlayer) + if (ExecuteSpeech_Timer <= diff) { - Reset(); - return; - } + Player* pPlayer = Unit::GetPlayer(*me, PlayerGUID); - //TODO: simplify text's selection + if (!pPlayer) + { + Reset(); + return; + } - switch(pPlayer->getRace()) - { - case RACE_HUMAN: - switch(ExecuteSpeech_Counter) - { - case 0: DoScriptText(SAY_EXEC_START_1, me, pPlayer); break; - case 1: me->SetStandState(UNIT_STAND_STATE_STAND); break; - case 2: DoScriptText(SAY_EXEC_PROG_5, me, pPlayer); break; - case 3: DoScriptText(SAY_EXEC_NAME_1, me, pPlayer); break; - case 4: DoScriptText(SAY_EXEC_RECOG_1, me, pPlayer); break; - case 5: DoScriptText(SAY_EXEC_NOREM_5, me, pPlayer); break; - case 6: DoScriptText(SAY_EXEC_THINK_7, me, pPlayer); break; - case 7: DoScriptText(SAY_EXEC_LISTEN_1, me, pPlayer); break; - case 8: - if (Creature* Plaguefist = GetClosestCreatureWithEntry(me, NPC_PLAGUEFIST, 85.0f)) - DoScriptText(SAY_PLAGUEFIST, Plaguefist, pPlayer); - break; - case 9: - DoScriptText(SAY_EXEC_TIME_6, me, pPlayer); - me->SetStandState(UNIT_STAND_STATE_KNEEL); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); - break; - case 10: DoScriptText(SAY_EXEC_WAITING, me, pPlayer); break; - case 11: - DoScriptText(EMOTE_DIES, me); - me->setDeathState(JUST_DIED); - me->SetHealth(0); - return; - } - break; - case RACE_ORC: - switch(ExecuteSpeech_Counter) - { - case 0: DoScriptText(SAY_EXEC_START_1, me, pPlayer); break; - case 1: me->SetStandState(UNIT_STAND_STATE_STAND); break; - case 2: DoScriptText(SAY_EXEC_PROG_6, me, pPlayer); break; - case 3: DoScriptText(SAY_EXEC_NAME_1, me, pPlayer); break; - case 4: DoScriptText(SAY_EXEC_RECOG_1, me, pPlayer); break; - case 5: DoScriptText(SAY_EXEC_NOREM_7, me, pPlayer); break; - case 6: DoScriptText(SAY_EXEC_THINK_8, me, pPlayer); break; - case 7: DoScriptText(SAY_EXEC_LISTEN_1, me, pPlayer); break; - case 8: - if (Creature* Plaguefist = GetClosestCreatureWithEntry(me, NPC_PLAGUEFIST, 85.0f)) - DoScriptText(SAY_PLAGUEFIST, Plaguefist, pPlayer); - break; - case 9: - DoScriptText(SAY_EXEC_TIME_8, me, pPlayer); - me->SetStandState(UNIT_STAND_STATE_KNEEL); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); - break; - case 10: DoScriptText(SAY_EXEC_WAITING, me, pPlayer); break; - case 11: - DoScriptText(EMOTE_DIES, me); - me->setDeathState(JUST_DIED); - me->SetHealth(0); - return; - } - break; - case RACE_DWARF: - switch(ExecuteSpeech_Counter) - { - case 0: DoScriptText(SAY_EXEC_START_2, me, pPlayer); break; - case 1: me->SetStandState(UNIT_STAND_STATE_STAND); break; - case 2: DoScriptText(SAY_EXEC_PROG_2, me, pPlayer); break; - case 3: DoScriptText(SAY_EXEC_NAME_1, me, pPlayer); break; - case 4: DoScriptText(SAY_EXEC_RECOG_3, me, pPlayer); break; - case 5: DoScriptText(SAY_EXEC_NOREM_2, me, pPlayer); break; - case 6: DoScriptText(SAY_EXEC_THINK_5, me, pPlayer); break; - case 7: DoScriptText(SAY_EXEC_LISTEN_2, me, pPlayer); break; - case 8: - if (Creature* Plaguefist = GetClosestCreatureWithEntry(me, NPC_PLAGUEFIST, 85.0f)) - DoScriptText(SAY_PLAGUEFIST, Plaguefist, pPlayer); - break; - case 9: - DoScriptText(SAY_EXEC_TIME_3, me, pPlayer); - me->SetStandState(UNIT_STAND_STATE_KNEEL); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); - break; - case 10: DoScriptText(SAY_EXEC_WAITING, me, pPlayer); break; - case 11: - DoScriptText(EMOTE_DIES, me); - me->setDeathState(JUST_DIED); - me->SetHealth(0); - return; - } - break; - case RACE_NIGHTELF: - switch(ExecuteSpeech_Counter) - { - case 0: DoScriptText(SAY_EXEC_START_1, me, pPlayer); break; - case 1: me->SetStandState(UNIT_STAND_STATE_STAND); break; - case 2: DoScriptText(SAY_EXEC_PROG_5, me, pPlayer); break; - case 3: DoScriptText(SAY_EXEC_NAME_1, me, pPlayer); break; - case 4: DoScriptText(SAY_EXEC_RECOG_1, me, pPlayer); break; - case 5: DoScriptText(SAY_EXEC_NOREM_6, me, pPlayer); break; - case 6: DoScriptText(SAY_EXEC_THINK_2, me, pPlayer); break; - case 7: DoScriptText(SAY_EXEC_LISTEN_1, me, pPlayer); break; - case 8: - if (Creature* Plaguefist = GetClosestCreatureWithEntry(me, NPC_PLAGUEFIST, 85.0f)) - DoScriptText(SAY_PLAGUEFIST, Plaguefist, pPlayer); - break; - case 9: - DoScriptText(SAY_EXEC_TIME_7, me, pPlayer); - me->SetStandState(UNIT_STAND_STATE_KNEEL); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); - break; - case 10: DoScriptText(SAY_EXEC_WAITING, me, pPlayer); break; - case 11: - DoScriptText(EMOTE_DIES, me); - me->setDeathState(JUST_DIED); - me->SetHealth(0); - return; - } - break; - case RACE_UNDEAD_PLAYER: - switch(ExecuteSpeech_Counter) - { - case 0: DoScriptText(SAY_EXEC_START_1, me, pPlayer); break; - case 1: me->SetStandState(UNIT_STAND_STATE_STAND); break; - case 2: DoScriptText(SAY_EXEC_PROG_3, me, pPlayer); break; - case 3: DoScriptText(SAY_EXEC_NAME_1, me, pPlayer); break; - case 4: DoScriptText(SAY_EXEC_RECOG_4, me, pPlayer); break; - case 5: DoScriptText(SAY_EXEC_NOREM_3, me, pPlayer); break; - case 6: DoScriptText(SAY_EXEC_THINK_1, me, pPlayer); break; - case 7: DoScriptText(SAY_EXEC_LISTEN_3, me, pPlayer); break; - case 8: - if (Creature* Plaguefist = GetClosestCreatureWithEntry(me, NPC_PLAGUEFIST, 85.0f)) - DoScriptText(SAY_PLAGUEFIST, Plaguefist, pPlayer); - break; - case 9: - DoScriptText(SAY_EXEC_TIME_4, me, pPlayer); - me->SetStandState(UNIT_STAND_STATE_KNEEL); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); - break; - case 10: DoScriptText(SAY_EXEC_WAITING, me, pPlayer); break; - case 11: - DoScriptText(EMOTE_DIES, me); - me->setDeathState(JUST_DIED); - me->SetHealth(0); - return; - } - break; - case RACE_TAUREN: - switch(ExecuteSpeech_Counter) - { - case 0: DoScriptText(SAY_EXEC_START_1, me, pPlayer); break; - case 1: me->SetStandState(UNIT_STAND_STATE_STAND); break; - case 2: DoScriptText(SAY_EXEC_PROG_1, me, pPlayer); break; - case 3: DoScriptText(SAY_EXEC_NAME_1, me, pPlayer); break; - case 4: DoScriptText(SAY_EXEC_RECOG_5, me, pPlayer); break; - case 5: DoScriptText(SAY_EXEC_NOREM_8, me, pPlayer); break; - case 6: DoScriptText(SAY_EXEC_THINK_9, me, pPlayer); break; - case 7: DoScriptText(SAY_EXEC_LISTEN_1, me, pPlayer); break; - case 8: - if (Creature* Plaguefist = GetClosestCreatureWithEntry(me, NPC_PLAGUEFIST, 85.0f)) - DoScriptText(SAY_PLAGUEFIST, Plaguefist, pPlayer); - break; - case 9: - DoScriptText(SAY_EXEC_TIME_9, me, pPlayer); - me->SetStandState(UNIT_STAND_STATE_KNEEL); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); - break; - case 10: DoScriptText(SAY_EXEC_WAITING, me, pPlayer); break; - case 11: - DoScriptText(EMOTE_DIES, me); - me->setDeathState(JUST_DIED); - me->SetHealth(0); - return; - } - break; - case RACE_GNOME: - switch(ExecuteSpeech_Counter) - { - case 0: DoScriptText(SAY_EXEC_START_1, me, pPlayer); break; - case 1: me->SetStandState(UNIT_STAND_STATE_STAND); break; - case 2: DoScriptText(SAY_EXEC_PROG_4, me, pPlayer); break; - case 3: DoScriptText(SAY_EXEC_NAME_1, me, pPlayer); break; - case 4: DoScriptText(SAY_EXEC_RECOG_1, me, pPlayer); break; - case 5: DoScriptText(SAY_EXEC_NOREM_4, me, pPlayer); break; - case 6: DoScriptText(SAY_EXEC_THINK_6, me, pPlayer); break; - case 7: DoScriptText(SAY_EXEC_LISTEN_1, me, pPlayer); break; - case 8: - if (Creature* Plaguefist = GetClosestCreatureWithEntry(me, NPC_PLAGUEFIST, 85.0f)) - DoScriptText(SAY_PLAGUEFIST, Plaguefist, pPlayer); - break; - case 9: - DoScriptText(SAY_EXEC_TIME_5, me, pPlayer); - me->SetStandState(UNIT_STAND_STATE_KNEEL); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); - break; - case 10: DoScriptText(SAY_EXEC_WAITING, me, pPlayer); break; - case 11: - DoScriptText(EMOTE_DIES, me); - me->setDeathState(JUST_DIED); - me->SetHealth(0); - return; - } - break; - case RACE_TROLL: - switch(ExecuteSpeech_Counter) - { - case 0: DoScriptText(SAY_EXEC_START_3, me, pPlayer); break; - case 1: me->SetStandState(UNIT_STAND_STATE_STAND); break; - case 2: DoScriptText(SAY_EXEC_PROG_7, me, pPlayer); break; - case 3: DoScriptText(SAY_EXEC_NAME_2, me, pPlayer); break; - case 4: DoScriptText(SAY_EXEC_RECOG_6, me, pPlayer); break; - case 5: DoScriptText(SAY_EXEC_NOREM_9, me, pPlayer); break; - case 6: DoScriptText(SAY_EXEC_THINK_10, me, pPlayer); break; - case 7: DoScriptText(SAY_EXEC_LISTEN_4, me, pPlayer); break; - case 8: - if (Creature* Plaguefist = GetClosestCreatureWithEntry(me, NPC_PLAGUEFIST, 85.0f)) - DoScriptText(SAY_PLAGUEFIST, Plaguefist, pPlayer); - break; - case 9: - DoScriptText(SAY_EXEC_TIME_10, me, pPlayer); - me->SetStandState(UNIT_STAND_STATE_KNEEL); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); - break; - case 10: DoScriptText(SAY_EXEC_WAITING, me, pPlayer); break; - case 11: - DoScriptText(EMOTE_DIES, me); - me->setDeathState(JUST_DIED); - me->SetHealth(0); - return; - } - break; - case RACE_BLOODELF: - switch(ExecuteSpeech_Counter) - { - case 0: DoScriptText(SAY_EXEC_START_1, me, pPlayer); break; - case 1: me->SetStandState(UNIT_STAND_STATE_STAND); break; - case 2: DoScriptText(SAY_EXEC_PROG_1, me, pPlayer); break; - case 3: DoScriptText(SAY_EXEC_NAME_1, me, pPlayer); break; - case 4: DoScriptText(SAY_EXEC_RECOG_1, me, pPlayer); break; - //case 5: //unknown - case 6: DoScriptText(SAY_EXEC_THINK_3, me, pPlayer); break; - case 7: DoScriptText(SAY_EXEC_LISTEN_1, me, pPlayer); break; - case 8: - if (Creature* Plaguefist = GetClosestCreatureWithEntry(me, NPC_PLAGUEFIST, 85.0f)) - DoScriptText(SAY_PLAGUEFIST, Plaguefist, pPlayer); - break; - case 9: - DoScriptText(SAY_EXEC_TIME_1, me, pPlayer); - me->SetStandState(UNIT_STAND_STATE_KNEEL); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); - break; - case 10: DoScriptText(SAY_EXEC_WAITING, me, pPlayer); break; - case 11: - DoScriptText(EMOTE_DIES, me); - me->setDeathState(JUST_DIED); - me->SetHealth(0); - return; - } - break; - case RACE_DRAENEI: - switch(ExecuteSpeech_Counter) - { - case 0: DoScriptText(SAY_EXEC_START_1, me, pPlayer); break; - case 1: me->SetStandState(UNIT_STAND_STATE_STAND); break; - case 2: DoScriptText(SAY_EXEC_PROG_1, me, pPlayer); break; - case 3: DoScriptText(SAY_EXEC_NAME_1, me, pPlayer); break; - case 4: DoScriptText(SAY_EXEC_RECOG_2, me, pPlayer); break; - case 5: DoScriptText(SAY_EXEC_NOREM_1, me, pPlayer); break; - case 6: DoScriptText(SAY_EXEC_THINK_4, me, pPlayer); break; - case 7: DoScriptText(SAY_EXEC_LISTEN_1, me, pPlayer); break; - case 8: - if (Creature* Plaguefist = GetClosestCreatureWithEntry(me, NPC_PLAGUEFIST, 85.0f)) - DoScriptText(SAY_PLAGUEFIST, Plaguefist, pPlayer); - break; - case 9: - DoScriptText(SAY_EXEC_TIME_2, me, pPlayer); - me->SetStandState(UNIT_STAND_STATE_KNEEL); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); - break; - case 10: DoScriptText(SAY_EXEC_WAITING, me, pPlayer); break; - case 11: - DoScriptText(EMOTE_DIES, me); - me->setDeathState(JUST_DIED); - me->SetHealth(0); - return; - } - break; - } + //TODO: simplify text's selection - if (ExecuteSpeech_Counter >= 9) - ExecuteSpeech_Timer = 15000; - else - ExecuteSpeech_Timer = 7000; + switch(pPlayer->getRace()) + { + case RACE_HUMAN: + switch(ExecuteSpeech_Counter) + { + case 0: DoScriptText(SAY_EXEC_START_1, me, pPlayer); break; + case 1: me->SetStandState(UNIT_STAND_STATE_STAND); break; + case 2: DoScriptText(SAY_EXEC_PROG_5, me, pPlayer); break; + case 3: DoScriptText(SAY_EXEC_NAME_1, me, pPlayer); break; + case 4: DoScriptText(SAY_EXEC_RECOG_1, me, pPlayer); break; + case 5: DoScriptText(SAY_EXEC_NOREM_5, me, pPlayer); break; + case 6: DoScriptText(SAY_EXEC_THINK_7, me, pPlayer); break; + case 7: DoScriptText(SAY_EXEC_LISTEN_1, me, pPlayer); break; + case 8: + if (Creature* Plaguefist = GetClosestCreatureWithEntry(me, NPC_PLAGUEFIST, 85.0f)) + DoScriptText(SAY_PLAGUEFIST, Plaguefist, pPlayer); + break; + case 9: + DoScriptText(SAY_EXEC_TIME_6, me, pPlayer); + me->SetStandState(UNIT_STAND_STATE_KNEEL); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + break; + case 10: DoScriptText(SAY_EXEC_WAITING, me, pPlayer); break; + case 11: + DoScriptText(EMOTE_DIES, me); + me->setDeathState(JUST_DIED); + me->SetHealth(0); + return; + } + break; + case RACE_ORC: + switch(ExecuteSpeech_Counter) + { + case 0: DoScriptText(SAY_EXEC_START_1, me, pPlayer); break; + case 1: me->SetStandState(UNIT_STAND_STATE_STAND); break; + case 2: DoScriptText(SAY_EXEC_PROG_6, me, pPlayer); break; + case 3: DoScriptText(SAY_EXEC_NAME_1, me, pPlayer); break; + case 4: DoScriptText(SAY_EXEC_RECOG_1, me, pPlayer); break; + case 5: DoScriptText(SAY_EXEC_NOREM_7, me, pPlayer); break; + case 6: DoScriptText(SAY_EXEC_THINK_8, me, pPlayer); break; + case 7: DoScriptText(SAY_EXEC_LISTEN_1, me, pPlayer); break; + case 8: + if (Creature* Plaguefist = GetClosestCreatureWithEntry(me, NPC_PLAGUEFIST, 85.0f)) + DoScriptText(SAY_PLAGUEFIST, Plaguefist, pPlayer); + break; + case 9: + DoScriptText(SAY_EXEC_TIME_8, me, pPlayer); + me->SetStandState(UNIT_STAND_STATE_KNEEL); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + break; + case 10: DoScriptText(SAY_EXEC_WAITING, me, pPlayer); break; + case 11: + DoScriptText(EMOTE_DIES, me); + me->setDeathState(JUST_DIED); + me->SetHealth(0); + return; + } + break; + case RACE_DWARF: + switch(ExecuteSpeech_Counter) + { + case 0: DoScriptText(SAY_EXEC_START_2, me, pPlayer); break; + case 1: me->SetStandState(UNIT_STAND_STATE_STAND); break; + case 2: DoScriptText(SAY_EXEC_PROG_2, me, pPlayer); break; + case 3: DoScriptText(SAY_EXEC_NAME_1, me, pPlayer); break; + case 4: DoScriptText(SAY_EXEC_RECOG_3, me, pPlayer); break; + case 5: DoScriptText(SAY_EXEC_NOREM_2, me, pPlayer); break; + case 6: DoScriptText(SAY_EXEC_THINK_5, me, pPlayer); break; + case 7: DoScriptText(SAY_EXEC_LISTEN_2, me, pPlayer); break; + case 8: + if (Creature* Plaguefist = GetClosestCreatureWithEntry(me, NPC_PLAGUEFIST, 85.0f)) + DoScriptText(SAY_PLAGUEFIST, Plaguefist, pPlayer); + break; + case 9: + DoScriptText(SAY_EXEC_TIME_3, me, pPlayer); + me->SetStandState(UNIT_STAND_STATE_KNEEL); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + break; + case 10: DoScriptText(SAY_EXEC_WAITING, me, pPlayer); break; + case 11: + DoScriptText(EMOTE_DIES, me); + me->setDeathState(JUST_DIED); + me->SetHealth(0); + return; + } + break; + case RACE_NIGHTELF: + switch(ExecuteSpeech_Counter) + { + case 0: DoScriptText(SAY_EXEC_START_1, me, pPlayer); break; + case 1: me->SetStandState(UNIT_STAND_STATE_STAND); break; + case 2: DoScriptText(SAY_EXEC_PROG_5, me, pPlayer); break; + case 3: DoScriptText(SAY_EXEC_NAME_1, me, pPlayer); break; + case 4: DoScriptText(SAY_EXEC_RECOG_1, me, pPlayer); break; + case 5: DoScriptText(SAY_EXEC_NOREM_6, me, pPlayer); break; + case 6: DoScriptText(SAY_EXEC_THINK_2, me, pPlayer); break; + case 7: DoScriptText(SAY_EXEC_LISTEN_1, me, pPlayer); break; + case 8: + if (Creature* Plaguefist = GetClosestCreatureWithEntry(me, NPC_PLAGUEFIST, 85.0f)) + DoScriptText(SAY_PLAGUEFIST, Plaguefist, pPlayer); + break; + case 9: + DoScriptText(SAY_EXEC_TIME_7, me, pPlayer); + me->SetStandState(UNIT_STAND_STATE_KNEEL); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + break; + case 10: DoScriptText(SAY_EXEC_WAITING, me, pPlayer); break; + case 11: + DoScriptText(EMOTE_DIES, me); + me->setDeathState(JUST_DIED); + me->SetHealth(0); + return; + } + break; + case RACE_UNDEAD_PLAYER: + switch(ExecuteSpeech_Counter) + { + case 0: DoScriptText(SAY_EXEC_START_1, me, pPlayer); break; + case 1: me->SetStandState(UNIT_STAND_STATE_STAND); break; + case 2: DoScriptText(SAY_EXEC_PROG_3, me, pPlayer); break; + case 3: DoScriptText(SAY_EXEC_NAME_1, me, pPlayer); break; + case 4: DoScriptText(SAY_EXEC_RECOG_4, me, pPlayer); break; + case 5: DoScriptText(SAY_EXEC_NOREM_3, me, pPlayer); break; + case 6: DoScriptText(SAY_EXEC_THINK_1, me, pPlayer); break; + case 7: DoScriptText(SAY_EXEC_LISTEN_3, me, pPlayer); break; + case 8: + if (Creature* Plaguefist = GetClosestCreatureWithEntry(me, NPC_PLAGUEFIST, 85.0f)) + DoScriptText(SAY_PLAGUEFIST, Plaguefist, pPlayer); + break; + case 9: + DoScriptText(SAY_EXEC_TIME_4, me, pPlayer); + me->SetStandState(UNIT_STAND_STATE_KNEEL); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + break; + case 10: DoScriptText(SAY_EXEC_WAITING, me, pPlayer); break; + case 11: + DoScriptText(EMOTE_DIES, me); + me->setDeathState(JUST_DIED); + me->SetHealth(0); + return; + } + break; + case RACE_TAUREN: + switch(ExecuteSpeech_Counter) + { + case 0: DoScriptText(SAY_EXEC_START_1, me, pPlayer); break; + case 1: me->SetStandState(UNIT_STAND_STATE_STAND); break; + case 2: DoScriptText(SAY_EXEC_PROG_1, me, pPlayer); break; + case 3: DoScriptText(SAY_EXEC_NAME_1, me, pPlayer); break; + case 4: DoScriptText(SAY_EXEC_RECOG_5, me, pPlayer); break; + case 5: DoScriptText(SAY_EXEC_NOREM_8, me, pPlayer); break; + case 6: DoScriptText(SAY_EXEC_THINK_9, me, pPlayer); break; + case 7: DoScriptText(SAY_EXEC_LISTEN_1, me, pPlayer); break; + case 8: + if (Creature* Plaguefist = GetClosestCreatureWithEntry(me, NPC_PLAGUEFIST, 85.0f)) + DoScriptText(SAY_PLAGUEFIST, Plaguefist, pPlayer); + break; + case 9: + DoScriptText(SAY_EXEC_TIME_9, me, pPlayer); + me->SetStandState(UNIT_STAND_STATE_KNEEL); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + break; + case 10: DoScriptText(SAY_EXEC_WAITING, me, pPlayer); break; + case 11: + DoScriptText(EMOTE_DIES, me); + me->setDeathState(JUST_DIED); + me->SetHealth(0); + return; + } + break; + case RACE_GNOME: + switch(ExecuteSpeech_Counter) + { + case 0: DoScriptText(SAY_EXEC_START_1, me, pPlayer); break; + case 1: me->SetStandState(UNIT_STAND_STATE_STAND); break; + case 2: DoScriptText(SAY_EXEC_PROG_4, me, pPlayer); break; + case 3: DoScriptText(SAY_EXEC_NAME_1, me, pPlayer); break; + case 4: DoScriptText(SAY_EXEC_RECOG_1, me, pPlayer); break; + case 5: DoScriptText(SAY_EXEC_NOREM_4, me, pPlayer); break; + case 6: DoScriptText(SAY_EXEC_THINK_6, me, pPlayer); break; + case 7: DoScriptText(SAY_EXEC_LISTEN_1, me, pPlayer); break; + case 8: + if (Creature* Plaguefist = GetClosestCreatureWithEntry(me, NPC_PLAGUEFIST, 85.0f)) + DoScriptText(SAY_PLAGUEFIST, Plaguefist, pPlayer); + break; + case 9: + DoScriptText(SAY_EXEC_TIME_5, me, pPlayer); + me->SetStandState(UNIT_STAND_STATE_KNEEL); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + break; + case 10: DoScriptText(SAY_EXEC_WAITING, me, pPlayer); break; + case 11: + DoScriptText(EMOTE_DIES, me); + me->setDeathState(JUST_DIED); + me->SetHealth(0); + return; + } + break; + case RACE_TROLL: + switch(ExecuteSpeech_Counter) + { + case 0: DoScriptText(SAY_EXEC_START_3, me, pPlayer); break; + case 1: me->SetStandState(UNIT_STAND_STATE_STAND); break; + case 2: DoScriptText(SAY_EXEC_PROG_7, me, pPlayer); break; + case 3: DoScriptText(SAY_EXEC_NAME_2, me, pPlayer); break; + case 4: DoScriptText(SAY_EXEC_RECOG_6, me, pPlayer); break; + case 5: DoScriptText(SAY_EXEC_NOREM_9, me, pPlayer); break; + case 6: DoScriptText(SAY_EXEC_THINK_10, me, pPlayer); break; + case 7: DoScriptText(SAY_EXEC_LISTEN_4, me, pPlayer); break; + case 8: + if (Creature* Plaguefist = GetClosestCreatureWithEntry(me, NPC_PLAGUEFIST, 85.0f)) + DoScriptText(SAY_PLAGUEFIST, Plaguefist, pPlayer); + break; + case 9: + DoScriptText(SAY_EXEC_TIME_10, me, pPlayer); + me->SetStandState(UNIT_STAND_STATE_KNEEL); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + break; + case 10: DoScriptText(SAY_EXEC_WAITING, me, pPlayer); break; + case 11: + DoScriptText(EMOTE_DIES, me); + me->setDeathState(JUST_DIED); + me->SetHealth(0); + return; + } + break; + case RACE_BLOODELF: + switch(ExecuteSpeech_Counter) + { + case 0: DoScriptText(SAY_EXEC_START_1, me, pPlayer); break; + case 1: me->SetStandState(UNIT_STAND_STATE_STAND); break; + case 2: DoScriptText(SAY_EXEC_PROG_1, me, pPlayer); break; + case 3: DoScriptText(SAY_EXEC_NAME_1, me, pPlayer); break; + case 4: DoScriptText(SAY_EXEC_RECOG_1, me, pPlayer); break; + //case 5: //unknown + case 6: DoScriptText(SAY_EXEC_THINK_3, me, pPlayer); break; + case 7: DoScriptText(SAY_EXEC_LISTEN_1, me, pPlayer); break; + case 8: + if (Creature* Plaguefist = GetClosestCreatureWithEntry(me, NPC_PLAGUEFIST, 85.0f)) + DoScriptText(SAY_PLAGUEFIST, Plaguefist, pPlayer); + break; + case 9: + DoScriptText(SAY_EXEC_TIME_1, me, pPlayer); + me->SetStandState(UNIT_STAND_STATE_KNEEL); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + break; + case 10: DoScriptText(SAY_EXEC_WAITING, me, pPlayer); break; + case 11: + DoScriptText(EMOTE_DIES, me); + me->setDeathState(JUST_DIED); + me->SetHealth(0); + return; + } + break; + case RACE_DRAENEI: + switch(ExecuteSpeech_Counter) + { + case 0: DoScriptText(SAY_EXEC_START_1, me, pPlayer); break; + case 1: me->SetStandState(UNIT_STAND_STATE_STAND); break; + case 2: DoScriptText(SAY_EXEC_PROG_1, me, pPlayer); break; + case 3: DoScriptText(SAY_EXEC_NAME_1, me, pPlayer); break; + case 4: DoScriptText(SAY_EXEC_RECOG_2, me, pPlayer); break; + case 5: DoScriptText(SAY_EXEC_NOREM_1, me, pPlayer); break; + case 6: DoScriptText(SAY_EXEC_THINK_4, me, pPlayer); break; + case 7: DoScriptText(SAY_EXEC_LISTEN_1, me, pPlayer); break; + case 8: + if (Creature* Plaguefist = GetClosestCreatureWithEntry(me, NPC_PLAGUEFIST, 85.0f)) + DoScriptText(SAY_PLAGUEFIST, Plaguefist, pPlayer); + break; + case 9: + DoScriptText(SAY_EXEC_TIME_2, me, pPlayer); + me->SetStandState(UNIT_STAND_STATE_KNEEL); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + break; + case 10: DoScriptText(SAY_EXEC_WAITING, me, pPlayer); break; + case 11: + DoScriptText(EMOTE_DIES, me); + me->setDeathState(JUST_DIED); + me->SetHealth(0); + return; + } + break; + } - ++ExecuteSpeech_Counter; + if (ExecuteSpeech_Counter >= 9) + ExecuteSpeech_Timer = 15000; + else + ExecuteSpeech_Timer = 7000; + + ++ExecuteSpeech_Counter; + } + else + ExecuteSpeech_Timer -= diff; } - else - ExecuteSpeech_Timer -= diff; } - } + }; + }; -CreatureAI* GetAI_npc_a_special_surprise(Creature* pCreature) -{ - return new npc_a_special_surpriseAI(pCreature); -} void AddSC_the_scarlet_enclave_c2() { - Script *newscript; - - // How to win friends and influence enemies - newscript = new Script; - newscript->Name = "npc_crusade_persuaded"; - newscript->GetAI = &GetAI_npc_crusade_persuaded; - newscript->RegisterSelf(); - - // Ambush At The Overlook - newscript = new Script; - newscript->Name = "mob_scarlet_courier"; - newscript->GetAI = &GetAI_mob_scarlet_courier; - newscript->RegisterSelf(); - - // 12727 Bloody Breakout - newscript = new Script; - newscript->Name = "npc_koltira_deathweaver"; - newscript->GetAI = &GetAI_npc_koltira_deathweaver; - newscript->pQuestAccept = &QuestAccept_npc_koltira_deathweaver; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_high_inquisitor_valroth"; - newscript->GetAI = &GetAI_mob_high_inquisitor_valroth; - newscript->RegisterSelf(); - - // A Special Suprise - newscript = new Script; - newscript->Name = "npc_a_special_surprise"; - newscript->GetAI = &GetAI_npc_a_special_surprise; - newscript->RegisterSelf(); + new npc_crusade_persuaded(); + new mob_scarlet_courier(); + new npc_koltira_deathweaver(); + new mob_high_inquisitor_valroth(); + new npc_a_special_surprise(); } - -/* --- Bloody Breakout -UPDATE `creature_template` SET `ScriptName`='npc_koltira_deathweaver' WHERE `entry`='28912'; -UPDATE `creature_template` SET `ScriptName`='mob_high_inquisitor_valroth',minmana=6489,maxmana=6489,unit_flags=32768 WHERE `entry`='29001'; -UPDATE `creature_template` SET `ScriptName`='mob_eventai', `AIName`='EventAI',minmana=1020,maxmana=1058,unit_flags=32768 WHERE (`entry`='29007'); -DELETE FROM creature_ai_scripts WHERE id BETWEEN 90030 AND 90033; -INSERT INTO `creature_ai_scripts` VALUES ('90030', '29007', '0', '0', '100', '1', '1000', '4000', '1000', '4000', '11', '15498', '1', '0', '0', '0', '0', '0', '0', '0', '0', '0', 'Crimson Acolyte - Holy Smite'); -INSERT INTO `creature_ai_scripts` VALUES ('90031', '29007', '0', '0', '100', '1', '1000', '10000', '20000', '21000', '11', '34809', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', 'Crimson Acolyte - Holy Fury'); -INSERT INTO `creature_ai_scripts` VALUES ('90032', '29007', '0', '0', '100', '1', '1000', '5000', '1000', '5000', '11', '19725', '1', '0', '0', '0', '0', '0', '0', '0', '0', '0', 'Crimson Acolyte - Turn Undead'); -INSERT INTO `creature_ai_scripts` VALUES ('90033', '29007', '4', '0', '100', '0', '0', '0', '0', '0', '11', '15498', '1', '0', '0', '0', '0', '0', '0', '0', '0', '0', 'Crimson Acolyte aggro'); -*/ diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp index 621dea1b84f..8d97daa1557 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp @@ -282,1402 +282,1407 @@ static Locations LightofDawnLoc[]= {2272.709, -5255.552, 78.226, 0}, // 28 Lich king kicked {2273.972, -5257.676, 78.862, 0} // 29 Lich king moves forward }; - -struct npc_highlord_darion_mograineAI : public npc_escortAI +
class npc_highlord_darion_mograine : public CreatureScript { - npc_highlord_darion_mograineAI(Creature *pCreature) : npc_escortAI(pCreature) - { - Reset(); - } +public: + npc_highlord_darion_mograine() : CreatureScript("npc_highlord_darion_mograine") { } - bool bIsBattle; - uint32 uiStep; - uint32 uiPhase_timer; - uint32 uiFight_duration; - uint32 uiTotal_dawn; - uint32 uiTotal_scourge; - uint32 uiSummon_counter; - - // Darion Mograine - uint32 uiAnti_magic_zone; - uint32 uiDeath_strike; - uint32 uiDeath_embrace; - uint32 uiIcy_touch; - uint32 uiUnholy_blight; - uint32 uiFight_speech; - uint32 uiSpawncheck; - uint32 uiTargetcheck; - - // Dawn - uint64 uiTirionGUID; - uint64 uiAlexandrosGUID; - uint64 uiDarionGUID; - uint64 uiKorfaxGUID; - uint64 uiMaxwellGUID; - uint64 uiEligorGUID; - uint64 uiRayneGUID; - uint64 uiDefenderGUID[ENCOUNTER_DEFENDER_NUMBER]; - uint64 uiEarthshatterGUID[ENCOUNTER_EARTHSHATTER_NUMBER]; - - // Death - uint64 uiKoltiraGUID; - uint64 uiOrbazGUID; - uint64 uiThassarianGUID; - uint64 uiLichKingGUID; - uint64 uiAbominationGUID[ENCOUNTER_ABOMINATION_NUMBER]; - uint64 uiBehemothGUID[ENCOUNTER_BEHEMOTH_NUMBER]; - uint64 uiGhoulGUID[ENCOUNTER_GHOUL_NUMBER]; - uint64 uiWarriorGUID[ENCOUNTER_WARRIOR_NUMBER]; - - void Reset() + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - if (!HasEscortState(STATE_ESCORT_ESCORTING)) + switch (uiAction) { - bIsBattle = false; - uiStep = 0; - uiPhase_timer = 3000; - uiFight_duration = 300000; // 5 minutes - uiTotal_dawn = ENCOUNTER_TOTAL_DAWN; - uiTotal_scourge = ENCOUNTER_TOTAL_SCOURGE; - uiSummon_counter = 0; - - uiAnti_magic_zone = urand(1000,6000); - uiDeath_strike = urand(5000,10000); - uiDeath_embrace = urand(5000,10000); - uiIcy_touch = urand(5000,10000); - uiUnholy_blight = urand(5000,10000); - - uiFight_speech = 15000; - uiSpawncheck = 1000; - uiTargetcheck = 10000; - - me->SetStandState(UNIT_STAND_STATE_STAND); - me->Mount(25279); - me->SetVisibility(VISIBILITY_ON); - - UpdateWorldState(me->GetMap(), WORLD_STATE_REMAINS, 0); - //UpdateWorldState(me->GetMap(), WORLD_STATE_COUNTDOWN, 0); - UpdateWorldState(me->GetMap(), WORLD_STATE_EVENT_BEGIN, 0); - - if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) - pTemp->setDeathState(JUST_DIED); - if (Creature* pTemp = Unit::GetCreature(*me, uiKorfaxGUID)) - pTemp->setDeathState(JUST_DIED); - if (Creature* pTemp = Unit::GetCreature(*me, uiMaxwellGUID)) - pTemp->setDeathState(JUST_DIED); - if (Creature* pTemp = Unit::GetCreature(*me, uiEligorGUID)) - pTemp->setDeathState(JUST_DIED); - if (Creature* pTemp = Unit::GetCreature(*me, uiRayneGUID)) - pTemp->setDeathState(JUST_DIED); - - uiTirionGUID = NULL; - uiKorfaxGUID = NULL; - uiMaxwellGUID = NULL; - uiEligorGUID = NULL; - uiRayneGUID = NULL; - - for (uint8 i = 0; i < ENCOUNTER_DEFENDER_NUMBER; ++i) - { - if (Creature* pTemp = Unit::GetCreature(*me, uiDefenderGUID[i])) - pTemp->setDeathState(JUST_DIED); - uiDefenderGUID[i] = 0; - } - for (uint8 i = 0; i < ENCOUNTER_EARTHSHATTER_NUMBER; ++i) - { - if (Creature* pTemp = Unit::GetCreature(*me, uiEarthshatterGUID[i])) - pTemp->setDeathState(JUST_DIED); - uiEarthshatterGUID[i] = 0; - } - - if (Creature* pTemp = Unit::GetCreature(*me, uiKoltiraGUID)) - pTemp->setDeathState(JUST_DIED); - if (Creature* pTemp = Unit::GetCreature(*me, uiOrbazGUID)) - pTemp->setDeathState(JUST_DIED); - if (Creature* pTemp = Unit::GetCreature(*me, uiThassarianGUID)) - pTemp->setDeathState(JUST_DIED); - if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) - pTemp->setDeathState(JUST_DIED); - - uiKoltiraGUID = NULL; - uiOrbazGUID = NULL; - uiThassarianGUID = NULL; - uiLichKingGUID = NULL; - for (uint8 i = 0; i < ENCOUNTER_ABOMINATION_NUMBER; ++i) - { - if (Creature* pTemp = Unit::GetCreature(*me, uiAbominationGUID[i])) - pTemp->setDeathState(JUST_DIED); - uiAbominationGUID[i] = 0; - } - for (uint8 i = 0; i < ENCOUNTER_BEHEMOTH_NUMBER; ++i) - { - if (Creature* pTemp = Unit::GetCreature(*me, uiBehemothGUID[i])) - pTemp->setDeathState(JUST_DIED); - uiBehemothGUID[i] = 0; - } - for (uint8 i = 0; i < ENCOUNTER_GHOUL_NUMBER; ++i) - { - if (Creature* pTemp = Unit::GetCreature(*me, uiGhoulGUID[i])) - pTemp->setDeathState(JUST_DIED); - uiGhoulGUID[i] = 0; - } - for (uint8 i = 0; i < ENCOUNTER_WARRIOR_NUMBER; ++i) - { - if (Creature* pTemp = Unit::GetCreature(*me, uiWarriorGUID[i])) - pTemp->setDeathState(JUST_DIED); - uiWarriorGUID[i] = 0; - } + case GOSSIP_ACTION_INFO_DEF+1: + pPlayer->CLOSE_GOSSIP_MENU(); + CAST_AI(npc_highlord_darion_mograine::npc_highlord_darion_mograineAI, pCreature->AI())->uiStep = 1; + CAST_AI(npc_highlord_darion_mograine::npc_highlord_darion_mograineAI, pCreature->AI())->Start(true, false, pPlayer->GetGUID()); + break; } + return true; } - void AttackStart(Unit* who) + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - if (!who) - return; - - if (who == me) - return; + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if (me->Attack(who, true)) - { - me->AddThreat(who, 0.0f); - me->SetInCombatWith(who); - who->SetInCombatWith(me); - DoStartMovement(who); - } - } + if (pPlayer->GetQuestStatus(12801) == QUEST_STATUS_INCOMPLETE) + pPlayer->ADD_GOSSIP_ITEM(0, "I am ready.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - void MoveInLineOfSight(Unit* who) - { - if (!who) - return; + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - if (who->isTargetableForAttack() && me->IsHostileTo(who)) - if (me->IsWithinDistInMap(who, 20) && me->IsWithinLOSInMap(who)) - AttackStart(who); + return true; } - void SetHoldState(bool bOnHold) + CreatureAI* GetAI(Creature* pCreature) const { - SetEscortPaused(bOnHold); + return new npc_highlord_darion_mograineAI(pCreature); } - void WaypointReached(uint32 i) + struct npc_highlord_darion_mograineAI : public npc_escortAI { - switch (i) + npc_highlord_darion_mograineAI(Creature *pCreature) : npc_escortAI(pCreature) { - case 0: - me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - SetHoldState(true); - break; - case 1: - SetHoldState(true); + Reset(); + } - SpawnNPC(); - if (Creature* pTemp = Unit::GetCreature(*me, uiKorfaxGUID)) - DoScriptText(SAY_LIGHT_OF_DAWN07, pTemp); - if (Creature* pTemp = Unit::GetCreature(*me, uiMaxwellGUID)) - DoScriptText(SAY_LIGHT_OF_DAWN08, pTemp); + bool bIsBattle; + uint32 uiStep; + uint32 uiPhase_timer; + uint32 uiFight_duration; + uint32 uiTotal_dawn; + uint32 uiTotal_scourge; + uint32 uiSummon_counter; + + // Darion Mograine + uint32 uiAnti_magic_zone; + uint32 uiDeath_strike; + uint32 uiDeath_embrace; + uint32 uiIcy_touch; + uint32 uiUnholy_blight; + uint32 uiFight_speech; + uint32 uiSpawncheck; + uint32 uiTargetcheck; - for (uint8 i = 0; i < ENCOUNTER_GHOUL_NUMBER; ++i) - NPCChangeTarget(uiGhoulGUID[i]); - for (uint8 i = 0; i < ENCOUNTER_WARRIOR_NUMBER; ++i) - NPCChangeTarget(uiWarriorGUID[i]); - for (uint8 i = 0; i < ENCOUNTER_ABOMINATION_NUMBER; ++i) - NPCChangeTarget(uiAbominationGUID[i]); - for (uint8 i = 0; i < ENCOUNTER_BEHEMOTH_NUMBER; ++i) - NPCChangeTarget(uiBehemothGUID[i]); - NPCChangeTarget(uiKoltiraGUID); - NPCChangeTarget(uiOrbazGUID); - NPCChangeTarget(uiThassarianGUID); + // Dawn + uint64 uiTirionGUID; + uint64 uiAlexandrosGUID; + uint64 uiDarionGUID; + uint64 uiKorfaxGUID; + uint64 uiMaxwellGUID; + uint64 uiEligorGUID; + uint64 uiRayneGUID; + uint64 uiDefenderGUID[ENCOUNTER_DEFENDER_NUMBER]; + uint64 uiEarthshatterGUID[ENCOUNTER_EARTHSHATTER_NUMBER]; - me->Unmount(); - me->CastSpell(me, SPELL_THE_MIGHT_OF_MOGRAINE, true); // need to fix, on player only + // Death + uint64 uiKoltiraGUID; + uint64 uiOrbazGUID; + uint64 uiThassarianGUID; + uint64 uiLichKingGUID; + uint64 uiAbominationGUID[ENCOUNTER_ABOMINATION_NUMBER]; + uint64 uiBehemothGUID[ENCOUNTER_BEHEMOTH_NUMBER]; + uint64 uiGhoulGUID[ENCOUNTER_GHOUL_NUMBER]; + uint64 uiWarriorGUID[ENCOUNTER_WARRIOR_NUMBER]; + + void Reset() + { + if (!HasEscortState(STATE_ESCORT_ESCORTING)) + { + bIsBattle = false; + uiStep = 0; + uiPhase_timer = 3000; + uiFight_duration = 300000; // 5 minutes + uiTotal_dawn = ENCOUNTER_TOTAL_DAWN; + uiTotal_scourge = ENCOUNTER_TOTAL_SCOURGE; + uiSummon_counter = 0; + + uiAnti_magic_zone = urand(1000,6000); + uiDeath_strike = urand(5000,10000); + uiDeath_embrace = urand(5000,10000); + uiIcy_touch = urand(5000,10000); + uiUnholy_blight = urand(5000,10000); + + uiFight_speech = 15000; + uiSpawncheck = 1000; + uiTargetcheck = 10000; - if (Creature* pTemp = Unit::GetCreature(*me, uiKoltiraGUID)) - pTemp->Unmount(); - if (Creature* pTemp = Unit::GetCreature(*me, uiThassarianGUID)) - pTemp->Unmount(); + me->SetStandState(UNIT_STAND_STATE_STAND); + me->Mount(25279); + me->SetVisibility(VISIBILITY_ON); - bIsBattle = true; - break; - case 2: - me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); - DoCast(me, SPELL_THE_LIGHT_OF_DAWN); - break; - case 3: - { - //Unit* pTirion = Unit::GetCreature(*me, uiTirionGUID); + UpdateWorldState(me->GetMap(), WORLD_STATE_REMAINS, 0); + //UpdateWorldState(me->GetMap(), WORLD_STATE_COUNTDOWN, 0); + UpdateWorldState(me->GetMap(), WORLD_STATE_EVENT_BEGIN, 0); - DoScriptText(EMOTE_LIGHT_OF_DAWN05, me); - if (me->HasAura(SPELL_THE_LIGHT_OF_DAWN, 0)) - me->RemoveAurasDueToSpell(SPELL_THE_LIGHT_OF_DAWN); - if (Creature* pTemp = Unit::GetCreature(*me, uiKoltiraGUID)) + if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) + pTemp->setDeathState(JUST_DIED); + if (Creature* pTemp = Unit::GetCreature(*me, uiKorfaxGUID)) + pTemp->setDeathState(JUST_DIED); + if (Creature* pTemp = Unit::GetCreature(*me, uiMaxwellGUID)) + pTemp->setDeathState(JUST_DIED); + if (Creature* pTemp = Unit::GetCreature(*me, uiEligorGUID)) + pTemp->setDeathState(JUST_DIED); + if (Creature* pTemp = Unit::GetCreature(*me, uiRayneGUID)) + pTemp->setDeathState(JUST_DIED); + + uiTirionGUID = NULL; + uiKorfaxGUID = NULL; + uiMaxwellGUID = NULL; + uiEligorGUID = NULL; + uiRayneGUID = NULL; + + for (uint8 i = 0; i < ENCOUNTER_DEFENDER_NUMBER; ++i) { - if (pTemp->HasAura(SPELL_THE_LIGHT_OF_DAWN, 0)) - pTemp->RemoveAurasDueToSpell(SPELL_THE_LIGHT_OF_DAWN); - pTemp->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); - pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[19].x, LightofDawnLoc[19].y, LightofDawnLoc[19].z); + if (Creature* pTemp = Unit::GetCreature(*me, uiDefenderGUID[i])) + pTemp->setDeathState(JUST_DIED); + uiDefenderGUID[i] = 0; } + for (uint8 i = 0; i < ENCOUNTER_EARTHSHATTER_NUMBER; ++i) + { + if (Creature* pTemp = Unit::GetCreature(*me, uiEarthshatterGUID[i])) + pTemp->setDeathState(JUST_DIED); + uiEarthshatterGUID[i] = 0; + } + + if (Creature* pTemp = Unit::GetCreature(*me, uiKoltiraGUID)) + pTemp->setDeathState(JUST_DIED); + if (Creature* pTemp = Unit::GetCreature(*me, uiOrbazGUID)) + pTemp->setDeathState(JUST_DIED); if (Creature* pTemp = Unit::GetCreature(*me, uiThassarianGUID)) + pTemp->setDeathState(JUST_DIED); + if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) + pTemp->setDeathState(JUST_DIED); + + uiKoltiraGUID = NULL; + uiOrbazGUID = NULL; + uiThassarianGUID = NULL; + uiLichKingGUID = NULL; + for (uint8 i = 0; i < ENCOUNTER_ABOMINATION_NUMBER; ++i) { - if (pTemp->HasAura(SPELL_THE_LIGHT_OF_DAWN, 0)) - pTemp->RemoveAurasDueToSpell(SPELL_THE_LIGHT_OF_DAWN); - pTemp->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); - pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[21].x, LightofDawnLoc[21].y, LightofDawnLoc[21].z); + if (Creature* pTemp = Unit::GetCreature(*me, uiAbominationGUID[i])) + pTemp->setDeathState(JUST_DIED); + uiAbominationGUID[i] = 0; } - if (Creature* pTemp = Unit::GetCreature(*me, uiKorfaxGUID)) + for (uint8 i = 0; i < ENCOUNTER_BEHEMOTH_NUMBER; ++i) { - pTemp->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); - pTemp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY2H); - pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[10].x, LightofDawnLoc[10].y, LightofDawnLoc[10].z); + if (Creature* pTemp = Unit::GetCreature(*me, uiBehemothGUID[i])) + pTemp->setDeathState(JUST_DIED); + uiBehemothGUID[i] = 0; } - if (Creature* pTemp = Unit::GetCreature(*me, uiMaxwellGUID)) + for (uint8 i = 0; i < ENCOUNTER_GHOUL_NUMBER; ++i) { - pTemp->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); - pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[13].x, LightofDawnLoc[13].y, LightofDawnLoc[13].z); + if (Creature* pTemp = Unit::GetCreature(*me, uiGhoulGUID[i])) + pTemp->setDeathState(JUST_DIED); + uiGhoulGUID[i] = 0; } - if (Creature* pTemp = Unit::GetCreature(*me, uiEligorGUID)) + for (uint8 i = 0; i < ENCOUNTER_WARRIOR_NUMBER; ++i) { - pTemp->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); - pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[16].x, LightofDawnLoc[16].y, LightofDawnLoc[16].z); + if (Creature* pTemp = Unit::GetCreature(*me, uiWarriorGUID[i])) + pTemp->setDeathState(JUST_DIED); + uiWarriorGUID[i] = 0; } - JumpToNextStep(10000); - } break; - case 4: - DoScriptText(SAY_LIGHT_OF_DAWN27, me); - me->SetStandState(UNIT_STAND_STATE_KNEEL); + } + } - if (Creature* pTemp = Unit::GetCreature(*me, uiKoltiraGUID)) - pTemp->SetStandState(UNIT_STAND_STATE_KNEEL); - if (Creature* pTemp = Unit::GetCreature(*me, uiThassarianGUID)) - pTemp->SetStandState(UNIT_STAND_STATE_KNEEL); - SetHoldState(true); - break; - case 5: - DoScriptText(SAY_LIGHT_OF_DAWN33, me); - SetHoldState(true); - break; - case 6: - SetHoldState(true); - me->HandleEmoteCommand(EMOTE_ONESHOT_SPECIALATTACK1H); - JumpToNextStep(1000); - break; - case 7: - SetHoldState(true); - JumpToNextStep(2000); - break; - case 8: - me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 0, uint32(EQUIP_UNEQUIP)); - if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) - me->CastSpell(pTemp, SPELL_ASHBRINGER, true); - DoScriptText(EMOTE_LIGHT_OF_DAWN14, me); - SetHoldState(true); - break; + void AttackStart(Unit* who) + { + if (!who) + return; + + if (who == me) + return; + + if (me->Attack(who, true)) + { + me->AddThreat(who, 0.0f); + me->SetInCombatWith(who); + who->SetInCombatWith(me); + DoStartMovement(who); + } } - } - void EnterEvadeMode() - { - if (!bIsBattle)//do not reset self if we are in battle - npc_escortAI::EnterEvadeMode(); - } + void MoveInLineOfSight(Unit* who) + { + if (!who) + return; - void UpdateAI(const uint32 diff) - { - npc_escortAI::UpdateAI(diff); + if (who->isTargetableForAttack() && me->IsHostileTo(who)) + if (me->IsWithinDistInMap(who, 20) && me->IsWithinLOSInMap(who)) + AttackStart(who); + } + + void SetHoldState(bool bOnHold) + { + SetEscortPaused(bOnHold); + } - if (!bIsBattle) + void WaypointReached(uint32 i) { - if (uiPhase_timer <= diff) + switch (i) { - // ******* Before battle ***************************************************************** - switch (uiStep) + case 0: + me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + SetHoldState(true); + break; + case 1: + SetHoldState(true); + + SpawnNPC(); + if (Creature* pTemp = Unit::GetCreature(*me, uiKorfaxGUID)) + DoScriptText(SAY_LIGHT_OF_DAWN07, pTemp); + if (Creature* pTemp = Unit::GetCreature(*me, uiMaxwellGUID)) + DoScriptText(SAY_LIGHT_OF_DAWN08, pTemp); + + for (uint8 i = 0; i < ENCOUNTER_GHOUL_NUMBER; ++i) + NPCChangeTarget(uiGhoulGUID[i]); + for (uint8 i = 0; i < ENCOUNTER_WARRIOR_NUMBER; ++i) + NPCChangeTarget(uiWarriorGUID[i]); + for (uint8 i = 0; i < ENCOUNTER_ABOMINATION_NUMBER; ++i) + NPCChangeTarget(uiAbominationGUID[i]); + for (uint8 i = 0; i < ENCOUNTER_BEHEMOTH_NUMBER; ++i) + NPCChangeTarget(uiBehemothGUID[i]); + NPCChangeTarget(uiKoltiraGUID); + NPCChangeTarget(uiOrbazGUID); + NPCChangeTarget(uiThassarianGUID); + + me->Unmount(); + me->CastSpell(me, SPELL_THE_MIGHT_OF_MOGRAINE, true); // need to fix, on player only + + if (Creature* pTemp = Unit::GetCreature(*me, uiKoltiraGUID)) + pTemp->Unmount(); + if (Creature* pTemp = Unit::GetCreature(*me, uiThassarianGUID)) + pTemp->Unmount(); + + bIsBattle = true; + break; + case 2: + me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + DoCast(me, SPELL_THE_LIGHT_OF_DAWN); + break; + case 3: { - case 0: // countdown - //UpdateWorldState(me->GetMap(), WORLD_STATE_COUNTDOWN, 1); - break; - - case 1: // just delay - //UpdateWorldState(me->GetMap(), WORLD_STATE_REMAINS, 1); - UpdateWorldState(me->GetMap(), WORLD_STATE_COUNTDOWN, 0); - UpdateWorldState(me->GetMap(), WORLD_STATE_EVENT_BEGIN, 1); - me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - JumpToNextStep(3000); - break; - - case 2: - DoScriptText(SAY_LIGHT_OF_DAWN04, me); - if (Creature* pKoltira = GetClosestCreatureWithEntry(me, NPC_KOLTIRA_DEATHWEAVER, 50.0f)) - uiKoltiraGUID = pKoltira->GetGUID(); - if (Creature* pOrbaz = GetClosestCreatureWithEntry(me, NPC_ORBAZ_BLOODBANE, 50.0f)) - uiOrbazGUID = pOrbaz->GetGUID(); - if (Creature* pThassarian = GetClosestCreatureWithEntry(me, NPC_THASSARIAN, 50.0f)) - uiThassarianGUID = pThassarian->GetGUID(); - JumpToNextStep(10000); - break; - - case 3: // rise - DoScriptText(SAY_LIGHT_OF_DAWN05, me); - JumpToNextStep(3000); - break; - - case 4: // summon ghoul - // Dunno whats the summon spell, so workaround - DoCast(me, 33271); // shack effect - uiPhase_timer = 500; - if (uiSummon_counter < ENCOUNTER_GHOUL_NUMBER) - { - Unit* pTemp = me->SummonCreature(NPC_ACHERUS_GHOUL, (me->GetPositionX()-20)+rand()%40, (me->GetPositionY()-20)+rand()%40, me->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000); - pTemp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - pTemp->setFaction(2084); - uiGhoulGUID[uiSummon_counter] = pTemp->GetGUID(); - ++uiSummon_counter; - } - else - { - uiSummon_counter = 0; - ++uiStep; - } - break; + //Unit* pTirion = Unit::GetCreature(*me, uiTirionGUID); - case 5: // summon abomination - DoCast(me, 33271); // shack effect - uiPhase_timer = 500; - if (uiSummon_counter < ENCOUNTER_ABOMINATION_NUMBER) - { - Unit* pTemp = me->SummonCreature(NPC_RAMPAGING_ABOMINATION, (me->GetPositionX()-20)+rand()%40, (me->GetPositionY()-20)+rand()%40, me->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000); - pTemp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - pTemp->setFaction(2084); - uiAbominationGUID[uiSummon_counter] = pTemp->GetGUID(); - ++uiSummon_counter; - } - else - { - uiSummon_counter = 0; - ++uiStep; - } - break; + DoScriptText(EMOTE_LIGHT_OF_DAWN05, me); + if (me->HasAura(SPELL_THE_LIGHT_OF_DAWN, 0)) + me->RemoveAurasDueToSpell(SPELL_THE_LIGHT_OF_DAWN); + if (Creature* pTemp = Unit::GetCreature(*me, uiKoltiraGUID)) + { + if (pTemp->HasAura(SPELL_THE_LIGHT_OF_DAWN, 0)) + pTemp->RemoveAurasDueToSpell(SPELL_THE_LIGHT_OF_DAWN); + pTemp->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[19].x, LightofDawnLoc[19].y, LightofDawnLoc[19].z); + } + if (Creature* pTemp = Unit::GetCreature(*me, uiThassarianGUID)) + { + if (pTemp->HasAura(SPELL_THE_LIGHT_OF_DAWN, 0)) + pTemp->RemoveAurasDueToSpell(SPELL_THE_LIGHT_OF_DAWN); + pTemp->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[21].x, LightofDawnLoc[21].y, LightofDawnLoc[21].z); + } + if (Creature* pTemp = Unit::GetCreature(*me, uiKorfaxGUID)) + { + pTemp->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + pTemp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY2H); + pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[10].x, LightofDawnLoc[10].y, LightofDawnLoc[10].z); + } + if (Creature* pTemp = Unit::GetCreature(*me, uiMaxwellGUID)) + { + pTemp->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[13].x, LightofDawnLoc[13].y, LightofDawnLoc[13].z); + } + if (Creature* pTemp = Unit::GetCreature(*me, uiEligorGUID)) + { + pTemp->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[16].x, LightofDawnLoc[16].y, LightofDawnLoc[16].z); + } + JumpToNextStep(10000); + } break; + case 4: + DoScriptText(SAY_LIGHT_OF_DAWN27, me); + me->SetStandState(UNIT_STAND_STATE_KNEEL); + + if (Creature* pTemp = Unit::GetCreature(*me, uiKoltiraGUID)) + pTemp->SetStandState(UNIT_STAND_STATE_KNEEL); + if (Creature* pTemp = Unit::GetCreature(*me, uiThassarianGUID)) + pTemp->SetStandState(UNIT_STAND_STATE_KNEEL); + SetHoldState(true); + break; + case 5: + DoScriptText(SAY_LIGHT_OF_DAWN33, me); + SetHoldState(true); + break; + case 6: + SetHoldState(true); + me->HandleEmoteCommand(EMOTE_ONESHOT_SPECIALATTACK1H); + JumpToNextStep(1000); + break; + case 7: + SetHoldState(true); + JumpToNextStep(2000); + break; + case 8: + me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 0, uint32(EQUIP_UNEQUIP)); + if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) + me->CastSpell(pTemp, SPELL_ASHBRINGER, true); + DoScriptText(EMOTE_LIGHT_OF_DAWN14, me); + SetHoldState(true); + break; + } + } - case 6: // summon warrior - DoCast(me, 33271); // shack effect - uiPhase_timer = 500; - if (uiSummon_counter < ENCOUNTER_WARRIOR_NUMBER) - { - Unit* pTemp = me->SummonCreature(NPC_WARRIOR_OF_THE_FROZEN_WASTES, (me->GetPositionX()-20)+rand()%40, (me->GetPositionY()-20)+rand()%40, me->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000); - pTemp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - pTemp->setFaction(2084); - uiWarriorGUID[uiSummon_counter] = pTemp->GetGUID(); - ++uiSummon_counter; - } - else - { - uiSummon_counter = 0; - ++uiStep; - } - break; + void EnterEvadeMode() + { + if (!bIsBattle)//do not reset self if we are in battle + npc_escortAI::EnterEvadeMode(); + } - case 7: // summon warrior - DoCast(me, 33271); // shack effect - uiPhase_timer = 500; - if (uiSummon_counter < ENCOUNTER_BEHEMOTH_NUMBER) - { - Unit* pTemp = me->SummonCreature(NPC_FLESH_BEHEMOTH, (me->GetPositionX()-20)+rand()%40, (me->GetPositionY()-20)+rand()%40, me->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000); - pTemp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - pTemp->setFaction(2084); - uiBehemothGUID[uiSummon_counter] = pTemp->GetGUID(); - ++uiSummon_counter; - } - else - { - uiSummon_counter = 0; - ++uiStep; - } - break; + void UpdateAI(const uint32 diff) + { + npc_escortAI::UpdateAI(diff); + + if (!bIsBattle) + { + if (uiPhase_timer <= diff) + { + // ******* Before battle ***************************************************************** + switch (uiStep) + { + case 0: // countdown + //UpdateWorldState(me->GetMap(), WORLD_STATE_COUNTDOWN, 1); + break; + + case 1: // just delay + //UpdateWorldState(me->GetMap(), WORLD_STATE_REMAINS, 1); + UpdateWorldState(me->GetMap(), WORLD_STATE_COUNTDOWN, 0); + UpdateWorldState(me->GetMap(), WORLD_STATE_EVENT_BEGIN, 1); + me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + JumpToNextStep(3000); + break; + + case 2: + DoScriptText(SAY_LIGHT_OF_DAWN04, me); + if (Creature* pKoltira = GetClosestCreatureWithEntry(me, NPC_KOLTIRA_DEATHWEAVER, 50.0f)) + uiKoltiraGUID = pKoltira->GetGUID(); + if (Creature* pOrbaz = GetClosestCreatureWithEntry(me, NPC_ORBAZ_BLOODBANE, 50.0f)) + uiOrbazGUID = pOrbaz->GetGUID(); + if (Creature* pThassarian = GetClosestCreatureWithEntry(me, NPC_THASSARIAN, 50.0f)) + uiThassarianGUID = pThassarian->GetGUID(); + JumpToNextStep(10000); + break; + + case 3: // rise + DoScriptText(SAY_LIGHT_OF_DAWN05, me); + JumpToNextStep(3000); + break; + + case 4: // summon ghoul + // Dunno whats the summon spell, so workaround + DoCast(me, 33271); // shack effect + uiPhase_timer = 500; + if (uiSummon_counter < ENCOUNTER_GHOUL_NUMBER) + { + Unit* pTemp = me->SummonCreature(NPC_ACHERUS_GHOUL, (me->GetPositionX()-20)+rand()%40, (me->GetPositionY()-20)+rand()%40, me->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000); + pTemp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + pTemp->setFaction(2084); + uiGhoulGUID[uiSummon_counter] = pTemp->GetGUID(); + ++uiSummon_counter; + } + else + { + uiSummon_counter = 0; + ++uiStep; + } + break; - case 8: // summon announce - DoScriptText(SAY_LIGHT_OF_DAWN06, me); - JumpToNextStep(5000); - break; + case 5: // summon abomination + DoCast(me, 33271); // shack effect + uiPhase_timer = 500; + if (uiSummon_counter < ENCOUNTER_ABOMINATION_NUMBER) + { + Unit* pTemp = me->SummonCreature(NPC_RAMPAGING_ABOMINATION, (me->GetPositionX()-20)+rand()%40, (me->GetPositionY()-20)+rand()%40, me->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000); + pTemp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + pTemp->setFaction(2084); + uiAbominationGUID[uiSummon_counter] = pTemp->GetGUID(); + ++uiSummon_counter; + } + else + { + uiSummon_counter = 0; + ++uiStep; + } + break; - case 9: // charge begins - SetHoldState(false); - if (Creature* pTemp = Unit::GetCreature(*me, uiKoltiraGUID)) - { - pTemp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z); - } - if (Creature* pTemp = Unit::GetCreature(*me, uiOrbazGUID)) - { - pTemp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z); - } - if (Creature* pTemp = Unit::GetCreature(*me, uiThassarianGUID)) - { - pTemp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z); - } - for (uint8 i = 0; i < ENCOUNTER_ABOMINATION_NUMBER; ++i) - if (Creature* pTemp = Unit::GetCreature(*me, uiAbominationGUID[i])) - pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z); - for (uint8 i = 0; i < ENCOUNTER_BEHEMOTH_NUMBER; ++i) - if (Creature* pTemp = Unit::GetCreature(*me, uiBehemothGUID[i])) + case 6: // summon warrior + DoCast(me, 33271); // shack effect + uiPhase_timer = 500; + if (uiSummon_counter < ENCOUNTER_WARRIOR_NUMBER) + { + Unit* pTemp = me->SummonCreature(NPC_WARRIOR_OF_THE_FROZEN_WASTES, (me->GetPositionX()-20)+rand()%40, (me->GetPositionY()-20)+rand()%40, me->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000); + pTemp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + pTemp->setFaction(2084); + uiWarriorGUID[uiSummon_counter] = pTemp->GetGUID(); + ++uiSummon_counter; + } + else + { + uiSummon_counter = 0; + ++uiStep; + } + break; + + case 7: // summon warrior + DoCast(me, 33271); // shack effect + uiPhase_timer = 500; + if (uiSummon_counter < ENCOUNTER_BEHEMOTH_NUMBER) + { + Unit* pTemp = me->SummonCreature(NPC_FLESH_BEHEMOTH, (me->GetPositionX()-20)+rand()%40, (me->GetPositionY()-20)+rand()%40, me->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000); + pTemp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + pTemp->setFaction(2084); + uiBehemothGUID[uiSummon_counter] = pTemp->GetGUID(); + ++uiSummon_counter; + } + else + { + uiSummon_counter = 0; + ++uiStep; + } + break; + + case 8: // summon announce + DoScriptText(SAY_LIGHT_OF_DAWN06, me); + JumpToNextStep(5000); + break; + + case 9: // charge begins + SetHoldState(false); + if (Creature* pTemp = Unit::GetCreature(*me, uiKoltiraGUID)) + { + pTemp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z); - for (uint8 i = 0; i < ENCOUNTER_GHOUL_NUMBER; ++i) - if (Creature* pTemp = Unit::GetCreature(*me, uiGhoulGUID[i])) + } + if (Creature* pTemp = Unit::GetCreature(*me, uiOrbazGUID)) + { + pTemp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z); - for (uint8 i = 0; i < ENCOUNTER_WARRIOR_NUMBER; ++i) - if (Creature* pTemp = Unit::GetCreature(*me, uiWarriorGUID[i])) + } + if (Creature* pTemp = Unit::GetCreature(*me, uiThassarianGUID)) + { + pTemp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z); - JumpToNextStep(5000); - break; - - // ******* After battle ***************************************************************** - case 11: // Tirion starts to speak - if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) - DoScriptText(SAY_LIGHT_OF_DAWN28, pTemp); - JumpToNextStep(21000); - break; - - case 12: - if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) - DoScriptText(SAY_LIGHT_OF_DAWN29, pTemp); - JumpToNextStep(13000); - break; - - case 13: - if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) - DoScriptText(SAY_LIGHT_OF_DAWN30, pTemp); - JumpToNextStep(13000); - break; - - case 14: - me->SetStandState(UNIT_STAND_STATE_STAND); - DoScriptText(SAY_LIGHT_OF_DAWN31, me); - JumpToNextStep(7000); - break; - - case 15: // summon gate - if (Unit* pTemp = me->SummonCreature(NPC_HIGHLORD_ALEXANDROS_MOGRAINE, LightofDawnLoc[22].x, LightofDawnLoc[22].y, LightofDawnLoc[22].z, LightofDawnLoc[22].o, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000)) - { - pTemp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - pTemp->CastSpell(pTemp, SPELL_ALEXANDROS_MOGRAINE_SPAWN, true); - DoScriptText(EMOTE_LIGHT_OF_DAWN06, pTemp); - uiAlexandrosGUID = pTemp->GetGUID(); - } - JumpToNextStep(4000); - break; + } + for (uint8 i = 0; i < ENCOUNTER_ABOMINATION_NUMBER; ++i) + if (Creature* pTemp = Unit::GetCreature(*me, uiAbominationGUID[i])) + pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z); + for (uint8 i = 0; i < ENCOUNTER_BEHEMOTH_NUMBER; ++i) + if (Creature* pTemp = Unit::GetCreature(*me, uiBehemothGUID[i])) + pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z); + for (uint8 i = 0; i < ENCOUNTER_GHOUL_NUMBER; ++i) + if (Creature* pTemp = Unit::GetCreature(*me, uiGhoulGUID[i])) + pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z); + for (uint8 i = 0; i < ENCOUNTER_WARRIOR_NUMBER; ++i) + if (Creature* pTemp = Unit::GetCreature(*me, uiWarriorGUID[i])) + pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z); + JumpToNextStep(5000); + break; + + // ******* After battle ***************************************************************** + case 11: // Tirion starts to speak + if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) + DoScriptText(SAY_LIGHT_OF_DAWN28, pTemp); + JumpToNextStep(21000); + break; + + case 12: + if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) + DoScriptText(SAY_LIGHT_OF_DAWN29, pTemp); + JumpToNextStep(13000); + break; + + case 13: + if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) + DoScriptText(SAY_LIGHT_OF_DAWN30, pTemp); + JumpToNextStep(13000); + break; + + case 14: + me->SetStandState(UNIT_STAND_STATE_STAND); + DoScriptText(SAY_LIGHT_OF_DAWN31, me); + JumpToNextStep(7000); + break; + + case 15: // summon gate + if (Unit* pTemp = me->SummonCreature(NPC_HIGHLORD_ALEXANDROS_MOGRAINE, LightofDawnLoc[22].x, LightofDawnLoc[22].y, LightofDawnLoc[22].z, LightofDawnLoc[22].o, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000)) + { + pTemp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + pTemp->CastSpell(pTemp, SPELL_ALEXANDROS_MOGRAINE_SPAWN, true); + DoScriptText(EMOTE_LIGHT_OF_DAWN06, pTemp); + uiAlexandrosGUID = pTemp->GetGUID(); + } + JumpToNextStep(4000); + break; - case 16: // Alexandros out - if (Creature* pTemp = Unit::GetCreature(*me, uiAlexandrosGUID)) - { - pTemp->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[23].x, LightofDawnLoc[23].y, LightofDawnLoc[23].z); - DoScriptText(SAY_LIGHT_OF_DAWN32, pTemp); - } - SetHoldState(false); // makes darion turns back - JumpToNextStep(5000); - break; - - case 17: - me->SetStandState(UNIT_STAND_STATE_KNEEL); - DoScriptText(SAY_LIGHT_OF_DAWN34, me); - JumpToNextStep(5000); - break; - - case 18: // Darion's spirit out - if (Unit* pTemp = me->SummonCreature(NPC_DARION_MOGRAINE, LightofDawnLoc[24].x, LightofDawnLoc[24].y, LightofDawnLoc[24].z, LightofDawnLoc[24].o, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000)) - { - DoScriptText(SAY_LIGHT_OF_DAWN35, pTemp); - pTemp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - uiDarionGUID = pTemp->GetGUID(); - } - JumpToNextStep(4000); - break; + case 16: // Alexandros out + if (Creature* pTemp = Unit::GetCreature(*me, uiAlexandrosGUID)) + { + pTemp->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[23].x, LightofDawnLoc[23].y, LightofDawnLoc[23].z); + DoScriptText(SAY_LIGHT_OF_DAWN32, pTemp); + } + SetHoldState(false); // makes darion turns back + JumpToNextStep(5000); + break; + + case 17: + me->SetStandState(UNIT_STAND_STATE_KNEEL); + DoScriptText(SAY_LIGHT_OF_DAWN34, me); + JumpToNextStep(5000); + break; + + case 18: // Darion's spirit out + if (Unit* pTemp = me->SummonCreature(NPC_DARION_MOGRAINE, LightofDawnLoc[24].x, LightofDawnLoc[24].y, LightofDawnLoc[24].z, LightofDawnLoc[24].o, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000)) + { + DoScriptText(SAY_LIGHT_OF_DAWN35, pTemp); + pTemp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + uiDarionGUID = pTemp->GetGUID(); + } + JumpToNextStep(4000); + break; - case 19: // runs to father - if (Creature* pTemp = Unit::GetCreature(*me, uiDarionGUID)) - { - DoScriptText(EMOTE_LIGHT_OF_DAWN07, pTemp); - pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[25].x, LightofDawnLoc[25].y, LightofDawnLoc[25].z); - } - JumpToNextStep(4000); - break; - - case 20: - if (Creature* pTemp = Unit::GetCreature(*me, uiDarionGUID)) - DoScriptText(SAY_LIGHT_OF_DAWN36, pTemp); - JumpToNextStep(4000); - break; - - case 21: - if (Creature* pTemp = Unit::GetCreature(*me, uiDarionGUID)) - DoScriptText(EMOTE_LIGHT_OF_DAWN08, pTemp); - JumpToNextStep(4000); - break; - - case 22: - if (Creature* pTemp = Unit::GetCreature(*me, uiAlexandrosGUID)) - DoScriptText(SAY_LIGHT_OF_DAWN37, pTemp); - JumpToNextStep(8000); - break; - - case 23: - if (Creature* pTemp = Unit::GetCreature(*me, uiDarionGUID)) - DoScriptText(SAY_LIGHT_OF_DAWN38, pTemp); - JumpToNextStep(8000); - break; - - case 24: - if (Creature* pTemp = Unit::GetCreature(*me, uiAlexandrosGUID)) - DoScriptText(SAY_LIGHT_OF_DAWN39, pTemp); - - if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) // Tirion moves forward here - pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[1].x, LightofDawnLoc[1].y, LightofDawnLoc[1].z); - - JumpToNextStep(15000); - break; - - case 25: - if (Creature* pTemp = Unit::GetCreature(*me, uiDarionGUID)) - DoScriptText(SAY_LIGHT_OF_DAWN40, pTemp); - JumpToNextStep(11000); - break; - - case 26: - if (Creature* pTemp = Unit::GetCreature(*me, uiAlexandrosGUID)) - DoScriptText(SAY_LIGHT_OF_DAWN41, pTemp); - JumpToNextStep(5000); - break; - - case 27: - if (Creature* pTemp = Unit::GetCreature(*me, uiDarionGUID)) - pTemp->setDeathState(JUST_DIED); - JumpToNextStep(24000); - break; - - case 28: - if (Creature* pTemp = Unit::GetCreature(*me, uiAlexandrosGUID)) - DoScriptText(SAY_LIGHT_OF_DAWN42, pTemp); - JumpToNextStep(6000); - break; - - case 29: // lich king spawns - if (Unit* pTemp = me->SummonCreature(NPC_THE_LICH_KING, LightofDawnLoc[26].x, LightofDawnLoc[26].y, LightofDawnLoc[26].z, LightofDawnLoc[26].o, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000)) - { - DoScriptText(SAY_LIGHT_OF_DAWN43, pTemp); - uiLichKingGUID = pTemp->GetGUID(); - if (Unit* pAlex = Unit::GetCreature(*me, uiAlexandrosGUID)) - pTemp->CastSpell(pAlex, SPELL_SOUL_FEAST_ALEX, false); - } - JumpToNextStep(2000); - break; + case 19: // runs to father + if (Creature* pTemp = Unit::GetCreature(*me, uiDarionGUID)) + { + DoScriptText(EMOTE_LIGHT_OF_DAWN07, pTemp); + pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[25].x, LightofDawnLoc[25].y, LightofDawnLoc[25].z); + } + JumpToNextStep(4000); + break; + + case 20: + if (Creature* pTemp = Unit::GetCreature(*me, uiDarionGUID)) + DoScriptText(SAY_LIGHT_OF_DAWN36, pTemp); + JumpToNextStep(4000); + break; + + case 21: + if (Creature* pTemp = Unit::GetCreature(*me, uiDarionGUID)) + DoScriptText(EMOTE_LIGHT_OF_DAWN08, pTemp); + JumpToNextStep(4000); + break; + + case 22: + if (Creature* pTemp = Unit::GetCreature(*me, uiAlexandrosGUID)) + DoScriptText(SAY_LIGHT_OF_DAWN37, pTemp); + JumpToNextStep(8000); + break; + + case 23: + if (Creature* pTemp = Unit::GetCreature(*me, uiDarionGUID)) + DoScriptText(SAY_LIGHT_OF_DAWN38, pTemp); + JumpToNextStep(8000); + break; + + case 24: + if (Creature* pTemp = Unit::GetCreature(*me, uiAlexandrosGUID)) + DoScriptText(SAY_LIGHT_OF_DAWN39, pTemp); + + if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) // Tirion moves forward here + pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[1].x, LightofDawnLoc[1].y, LightofDawnLoc[1].z); + + JumpToNextStep(15000); + break; + + case 25: + if (Creature* pTemp = Unit::GetCreature(*me, uiDarionGUID)) + DoScriptText(SAY_LIGHT_OF_DAWN40, pTemp); + JumpToNextStep(11000); + break; + + case 26: + if (Creature* pTemp = Unit::GetCreature(*me, uiAlexandrosGUID)) + DoScriptText(SAY_LIGHT_OF_DAWN41, pTemp); + JumpToNextStep(5000); + break; + + case 27: + if (Creature* pTemp = Unit::GetCreature(*me, uiDarionGUID)) + pTemp->setDeathState(JUST_DIED); + JumpToNextStep(24000); + break; + + case 28: + if (Creature* pTemp = Unit::GetCreature(*me, uiAlexandrosGUID)) + DoScriptText(SAY_LIGHT_OF_DAWN42, pTemp); + JumpToNextStep(6000); + break; + + case 29: // lich king spawns + if (Unit* pTemp = me->SummonCreature(NPC_THE_LICH_KING, LightofDawnLoc[26].x, LightofDawnLoc[26].y, LightofDawnLoc[26].z, LightofDawnLoc[26].o, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000)) + { + DoScriptText(SAY_LIGHT_OF_DAWN43, pTemp); + uiLichKingGUID = pTemp->GetGUID(); + if (Unit* pAlex = Unit::GetCreature(*me, uiAlexandrosGUID)) + pTemp->CastSpell(pAlex, SPELL_SOUL_FEAST_ALEX, false); + } + JumpToNextStep(2000); + break; - case 30: - if (Creature* pTemp = Unit::GetCreature(*me, uiAlexandrosGUID)) // just hide him - { - DoScriptText(EMOTE_LIGHT_OF_DAWN09, pTemp); - pTemp->SetVisibility(VISIBILITY_OFF); - } - if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) - { - pTemp->InterruptNonMeleeSpells(false); - DoScriptText(SAY_LIGHT_OF_DAWN45, pTemp); - } - JumpToNextStep(3000); - break; - - case 31: - me->SetStandState(UNIT_STAND_STATE_STAND); - DoScriptText(EMOTE_LIGHT_OF_DAWN10, me); - DoScriptText(SAY_LIGHT_OF_DAWN44, me); - JumpToNextStep(3000); - break; - - case 32: - if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) - pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[27].x, LightofDawnLoc[27].y, LightofDawnLoc[27].z); - JumpToNextStep(6000); - break; - - case 33: // Darion supports to jump to lich king here - if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) - DoCast(me, SPELL_MOGRAINE_CHARGE); // jumping charge -// doesn't make it looks well, so workarounds, Darion charges, looks better - me->SetSpeed(MOVE_RUN, 3.0f); - me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - SetHoldState(false); - JumpToNextStep(0); - break; - - case 35: // Lich king counterattacks - if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) - { - pTemp->HandleEmoteCommand(EMOTE_ONESHOT_KICK); - DoScriptText(SAY_LIGHT_OF_DAWN46, pTemp); - } - me->SetSpeed(MOVE_RUN, 6.0f); - me->SetStandState(UNIT_STAND_STATE_DEAD); - SetHoldState(false); // Darion got kicked by lich king - JumpToNextStep(0); - break; - - case 37: // Lich king counterattacks - me->SetStandState(UNIT_STAND_STATE_KNEEL); - JumpToNextStep(3000); - break; - - case 38: - if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) - DoScriptText(SAY_LIGHT_OF_DAWN47, pTemp); - JumpToNextStep(8000); - break; - - case 39: - if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) - DoScriptText(SAY_LIGHT_OF_DAWN48, pTemp); - JumpToNextStep(15000); - break; - - case 40: - if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) - DoScriptText(SAY_LIGHT_OF_DAWN49, pTemp); - JumpToNextStep(17000); - break; - - case 41: // Lich king - Apocalypse - if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) - { - DoScriptText(EMOTE_LIGHT_OF_DAWN11, pTemp); - DoScriptText(SAY_LIGHT_OF_DAWN51, pTemp); - if (Unit* pTirion = Unit::GetCreature(*me, uiTirionGUID)) + case 30: + if (Creature* pTemp = Unit::GetCreature(*me, uiAlexandrosGUID)) // just hide him { - pTirion->SetStandState(UNIT_STAND_STATE_KNEEL); - //pTemp->CastSpell(pTirion, SPELL_APOCALYPSE, false); // not working - pTemp->CastSpell(pTirion, SPELL_SOUL_FEAST_TIRION, false); - DoScriptText(EMOTE_LIGHT_OF_DAWN12, pTirion); + DoScriptText(EMOTE_LIGHT_OF_DAWN09, pTemp); + pTemp->SetVisibility(VISIBILITY_OFF); } - } - JumpToNextStep(2000); - break; + if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) + { + pTemp->InterruptNonMeleeSpells(false); + DoScriptText(SAY_LIGHT_OF_DAWN45, pTemp); + } + JumpToNextStep(3000); + break; - case 42: // Maxwell yells for attack - { - float fLichPositionX = 0, - fLichPositionY = 0, - fLichPositionZ = 0; + case 31: + me->SetStandState(UNIT_STAND_STATE_STAND); + DoScriptText(EMOTE_LIGHT_OF_DAWN10, me); + DoScriptText(SAY_LIGHT_OF_DAWN44, me); + JumpToNextStep(3000); + break; + + case 32: + if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) + pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[27].x, LightofDawnLoc[27].y, LightofDawnLoc[27].z); + JumpToNextStep(6000); + break; + + case 33: // Darion supports to jump to lich king here + if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) + DoCast(me, SPELL_MOGRAINE_CHARGE); // jumping charge + // doesn't make it looks well, so workarounds, Darion charges, looks better + me->SetSpeed(MOVE_RUN, 3.0f); + me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + SetHoldState(false); + JumpToNextStep(0); + break; + + case 35: // Lich king counterattacks if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) { - fLichPositionX = pTemp->GetPositionX(); - fLichPositionY = pTemp->GetPositionY(); - fLichPositionZ = pTemp->GetPositionZ(); + pTemp->HandleEmoteCommand(EMOTE_ONESHOT_KICK); + DoScriptText(SAY_LIGHT_OF_DAWN46, pTemp); } + me->SetSpeed(MOVE_RUN, 6.0f); + me->SetStandState(UNIT_STAND_STATE_DEAD); + SetHoldState(false); // Darion got kicked by lich king + JumpToNextStep(0); + break; + + case 37: // Lich king counterattacks + me->SetStandState(UNIT_STAND_STATE_KNEEL); + JumpToNextStep(3000); + break; + + case 38: + if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) + DoScriptText(SAY_LIGHT_OF_DAWN47, pTemp); + JumpToNextStep(8000); + break; + + case 39: + if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) + DoScriptText(SAY_LIGHT_OF_DAWN48, pTemp); + JumpToNextStep(15000); + break; + + case 40: + if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) + DoScriptText(SAY_LIGHT_OF_DAWN49, pTemp); + JumpToNextStep(17000); + break; - if (fLichPositionX && fLichPositionY) + case 41: // Lich king - Apocalypse + if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) { - Unit* pTemp; - pTemp = me->SummonCreature(NPC_DEFENDER_OF_THE_LIGHT, LightofDawnLoc[0].x+rand()%10, LightofDawnLoc[0].y+rand()%10, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10000); - pTemp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_ATTACK_UNARMED); - pTemp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - pTemp->SetSpeed(MOVE_RUN, 2.0f); - pTemp->setFaction(me->getFaction()); - pTemp->GetMotionMaster()->MovePoint(0, fLichPositionX, fLichPositionY, fLichPositionZ); - uiDefenderGUID[0] = pTemp->GetGUID(); + DoScriptText(EMOTE_LIGHT_OF_DAWN11, pTemp); + DoScriptText(SAY_LIGHT_OF_DAWN51, pTemp); + if (Unit* pTirion = Unit::GetCreature(*me, uiTirionGUID)) + { + pTirion->SetStandState(UNIT_STAND_STATE_KNEEL); + //pTemp->CastSpell(pTirion, SPELL_APOCALYPSE, false); // not working + pTemp->CastSpell(pTirion, SPELL_SOUL_FEAST_TIRION, false); + DoScriptText(EMOTE_LIGHT_OF_DAWN12, pTirion); + } + } + JumpToNextStep(2000); + break; - pTemp = me->SummonCreature(NPC_RIMBLAT_EARTHSHATTER, LightofDawnLoc[0].x+rand()%10, LightofDawnLoc[0].y+rand()%10, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10000); - pTemp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_ATTACK_UNARMED); - pTemp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - pTemp->SetSpeed(MOVE_RUN, 2.0f); - pTemp->setFaction(me->getFaction()); - pTemp->GetMotionMaster()->MovePoint(0, fLichPositionX, fLichPositionY, fLichPositionZ); - uiEarthshatterGUID[0] = pTemp->GetGUID(); + case 42: // Maxwell yells for attack + { + float fLichPositionX = 0, + fLichPositionY = 0, + fLichPositionZ = 0; + if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) + { + fLichPositionX = pTemp->GetPositionX(); + fLichPositionY = pTemp->GetPositionY(); + fLichPositionZ = pTemp->GetPositionZ(); + } + + if (fLichPositionX && fLichPositionY) + { + Unit* pTemp; + pTemp = me->SummonCreature(NPC_DEFENDER_OF_THE_LIGHT, LightofDawnLoc[0].x+rand()%10, LightofDawnLoc[0].y+rand()%10, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10000); + pTemp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_ATTACK_UNARMED); + pTemp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + pTemp->SetSpeed(MOVE_RUN, 2.0f); + pTemp->setFaction(me->getFaction()); + pTemp->GetMotionMaster()->MovePoint(0, fLichPositionX, fLichPositionY, fLichPositionZ); + uiDefenderGUID[0] = pTemp->GetGUID(); + + pTemp = me->SummonCreature(NPC_RIMBLAT_EARTHSHATTER, LightofDawnLoc[0].x+rand()%10, LightofDawnLoc[0].y+rand()%10, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10000); + pTemp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_ATTACK_UNARMED); + pTemp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + pTemp->SetSpeed(MOVE_RUN, 2.0f); + pTemp->setFaction(me->getFaction()); + pTemp->GetMotionMaster()->MovePoint(0, fLichPositionX, fLichPositionY, fLichPositionZ); + uiEarthshatterGUID[0] = pTemp->GetGUID(); + } + if (Creature* pTemp = Unit::GetCreature(*me, uiMaxwellGUID)) + { + pTemp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_ATTACK_UNARMED); + pTemp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + pTemp->SetSpeed(MOVE_RUN, 2.0f); + pTemp->GetMotionMaster()->MovePoint(0, fLichPositionX, fLichPositionY, fLichPositionZ); + DoScriptText(SAY_LIGHT_OF_DAWN50, pTemp); + } + if (Creature* pTemp = Unit::GetCreature(*me, uiKorfaxGUID)) + { + pTemp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_ATTACK_UNARMED); + pTemp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + pTemp->SetSpeed(MOVE_RUN, 2.0f); + pTemp->HandleEmoteCommand(EMOTE_STATE_ATTACK_UNARMED); + pTemp->GetMotionMaster()->MovePoint(0, fLichPositionX, fLichPositionY, fLichPositionZ); + } + if (Creature* pTemp = Unit::GetCreature(*me, uiEligorGUID)) + { + pTemp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_ATTACK_UNARMED); + pTemp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + pTemp->SetSpeed(MOVE_RUN, 2.0f); + pTemp->GetMotionMaster()->MovePoint(0, fLichPositionX, fLichPositionY, fLichPositionZ); + } } + JumpToNextStep(4500); + break; + + case 43: // They all got kicked + if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) + DoScriptText(EMOTE_LIGHT_OF_DAWN13, pTemp); + if (Creature* pTemp = Unit::GetCreature(*me, uiMaxwellGUID)) { - pTemp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_ATTACK_UNARMED); - pTemp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - pTemp->SetSpeed(MOVE_RUN, 2.0f); - pTemp->GetMotionMaster()->MovePoint(0, fLichPositionX, fLichPositionY, fLichPositionZ); - DoScriptText(SAY_LIGHT_OF_DAWN50, pTemp); + pTemp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); + pTemp->SetSpeed(MOVE_RUN, 6.0f); + pTemp->SetStandState(UNIT_STAND_STATE_DEAD); + pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[14].x, LightofDawnLoc[14].y, LightofDawnLoc[14].z); } if (Creature* pTemp = Unit::GetCreature(*me, uiKorfaxGUID)) { - pTemp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_ATTACK_UNARMED); - pTemp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - pTemp->SetSpeed(MOVE_RUN, 2.0f); - pTemp->HandleEmoteCommand(EMOTE_STATE_ATTACK_UNARMED); - pTemp->GetMotionMaster()->MovePoint(0, fLichPositionX, fLichPositionY, fLichPositionZ); + pTemp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); + pTemp->SetSpeed(MOVE_RUN, 6.0f); + pTemp->SetStandState(UNIT_STAND_STATE_DEAD); + pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[11].x, LightofDawnLoc[11].y, LightofDawnLoc[11].z); } if (Creature* pTemp = Unit::GetCreature(*me, uiEligorGUID)) { - pTemp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_ATTACK_UNARMED); - pTemp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - pTemp->SetSpeed(MOVE_RUN, 2.0f); - pTemp->GetMotionMaster()->MovePoint(0, fLichPositionX, fLichPositionY, fLichPositionZ); + pTemp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); + pTemp->SetSpeed(MOVE_RUN, 6.0f); + pTemp->SetStandState(UNIT_STAND_STATE_DEAD); + pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[17].x, LightofDawnLoc[17].y, LightofDawnLoc[17].z); } - } - JumpToNextStep(4500); - break; - - case 43: // They all got kicked - if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) - DoScriptText(EMOTE_LIGHT_OF_DAWN13, pTemp); + if (Creature* pTemp = Unit::GetCreature(*me, uiDefenderGUID[0])) + { + pTemp->SetSpeed(MOVE_RUN, 6.0f); + pTemp->SetStandState(UNIT_STAND_STATE_DEAD); + pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[0].x+rand()%10, LightofDawnLoc[0].y+rand()%10, LightofDawnLoc[0].z); + } + if (Creature* pTemp = Unit::GetCreature(*me, uiEarthshatterGUID[0])) + { + pTemp->SetSpeed(MOVE_RUN, 6.0f); + pTemp->SetStandState(UNIT_STAND_STATE_DEAD); + pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[0].x+rand()%10, LightofDawnLoc[0].y+rand()%10, LightofDawnLoc[0].z); + } + JumpToNextStep(3000); + break; - if (Creature* pTemp = Unit::GetCreature(*me, uiMaxwellGUID)) - { - pTemp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); - pTemp->SetSpeed(MOVE_RUN, 6.0f); - pTemp->SetStandState(UNIT_STAND_STATE_DEAD); - pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[14].x, LightofDawnLoc[14].y, LightofDawnLoc[14].z); - } - if (Creature* pTemp = Unit::GetCreature(*me, uiKorfaxGUID)) - { - pTemp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); - pTemp->SetSpeed(MOVE_RUN, 6.0f); - pTemp->SetStandState(UNIT_STAND_STATE_DEAD); - pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[11].x, LightofDawnLoc[11].y, LightofDawnLoc[11].z); - } - if (Creature* pTemp = Unit::GetCreature(*me, uiEligorGUID)) - { - pTemp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); - pTemp->SetSpeed(MOVE_RUN, 6.0f); - pTemp->SetStandState(UNIT_STAND_STATE_DEAD); - pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[17].x, LightofDawnLoc[17].y, LightofDawnLoc[17].z); - } - if (Creature* pTemp = Unit::GetCreature(*me, uiDefenderGUID[0])) - { - pTemp->SetSpeed(MOVE_RUN, 6.0f); - pTemp->SetStandState(UNIT_STAND_STATE_DEAD); - pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[0].x+rand()%10, LightofDawnLoc[0].y+rand()%10, LightofDawnLoc[0].z); - } - if (Creature* pTemp = Unit::GetCreature(*me, uiEarthshatterGUID[0])) - { - pTemp->SetSpeed(MOVE_RUN, 6.0f); - pTemp->SetStandState(UNIT_STAND_STATE_DEAD); - pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[0].x+rand()%10, LightofDawnLoc[0].y+rand()%10, LightofDawnLoc[0].z); - } - JumpToNextStep(3000); - break; - - case 44: // make them stand up - if (Creature* pTemp = Unit::GetCreature(*me, uiMaxwellGUID)) - pTemp->SetStandState(UNIT_STAND_STATE_STAND); - if (Creature* pTemp = Unit::GetCreature(*me, uiKorfaxGUID)) - pTemp->SetStandState(UNIT_STAND_STATE_STAND); - if (Creature* pTemp = Unit::GetCreature(*me, uiEligorGUID)) - pTemp->SetStandState(UNIT_STAND_STATE_STAND); - JumpToNextStep(1000); - break; - - case 45: - DoScriptText(SAY_LIGHT_OF_DAWN52, me); - JumpToNextStep(5000); - break; - - case 46: // Darion stand up, "not today" - me->SetSpeed(MOVE_RUN, 1.0f); - me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); - me->SetStandState(UNIT_STAND_STATE_STAND); - DoScriptText(SAY_LIGHT_OF_DAWN53, me); - SetHoldState(false); // Darion throws sword - JumpToNextStep(7000); - break; - - case 47: // Ashbringer rebirth - me->SetStandState(UNIT_STAND_STATE_KNEEL); - DoScriptText(EMOTE_LIGHT_OF_DAWN15, me); - if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) - { - pTemp->SetStandState(UNIT_STAND_STATE_STAND); - pTemp->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 0, uint32(EQUIP_HIGHLORD_TIRION_FORDRING)); - pTemp->CastSpell(pTemp, SPELL_REBIRTH_OF_THE_ASHBRINGER, false); - } - JumpToNextStep(1000); - break; - - case 48: // Show the cleansing effect (dawn of light) - //if (GameObject* pGo = me->GetMap()->GetGameObject(uiDawnofLightGUID)) - // pGo->SetPhaseMask(128, true); - me->SummonGameObject(GO_LIGHT_OF_DAWN, 2283.896, -5287.914, 83.066, 0, 0, 0, 0, 0, 30000); - if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) - { - if (pTemp->HasAura(SPELL_REBIRTH_OF_THE_ASHBRINGER, 0)) - pTemp->RemoveAurasDueToSpell(SPELL_REBIRTH_OF_THE_ASHBRINGER); - pTemp->CastSpell(pTemp, 41542, false); // workarounds, light expoded, makes it cool - pTemp->HandleEmoteCommand(EMOTE_ONESHOT_ROAR); - } - if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) - pTemp->InterruptNonMeleeSpells(false); - JumpToNextStep(2500); - break; - - case 49: - if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) - DoScriptText(SAY_LIGHT_OF_DAWN54, pTemp); - JumpToNextStep(4000); - break; - - case 50: - if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) - DoScriptText(SAY_LIGHT_OF_DAWN55, pTemp); - JumpToNextStep(5000); - break; - - case 51: - if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) - DoScriptText(SAY_LIGHT_OF_DAWN56, pTemp); - JumpToNextStep(1000); - break; - - case 52: // Tiron charges - if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) - { - DoScriptText(EMOTE_LIGHT_OF_DAWN16, pTemp); - pTemp->CastSpell(pTemp, SPELL_TIRION_CHARGE, false); // jumping charge - pTemp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY2H); - pTemp->SetSpeed(MOVE_RUN, 3.0f); // workarounds, make Tirion still running - pTemp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[2].x, LightofDawnLoc[2].y, LightofDawnLoc[2].z); - if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) - pTemp->Relocate(LightofDawnLoc[28].x, LightofDawnLoc[28].y, LightofDawnLoc[28].z); // workarounds, he should kick back by Tirion, but here we relocate him - } - JumpToNextStep(1500); - break; + case 44: // make them stand up + if (Creature* pTemp = Unit::GetCreature(*me, uiMaxwellGUID)) + pTemp->SetStandState(UNIT_STAND_STATE_STAND); + if (Creature* pTemp = Unit::GetCreature(*me, uiKorfaxGUID)) + pTemp->SetStandState(UNIT_STAND_STATE_STAND); + if (Creature* pTemp = Unit::GetCreature(*me, uiEligorGUID)) + pTemp->SetStandState(UNIT_STAND_STATE_STAND); + JumpToNextStep(1000); + break; - case 53: - if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) - DoScriptText(SAY_LIGHT_OF_DAWN57, pTemp); - JumpToNextStep(1000); - break; + case 45: + DoScriptText(SAY_LIGHT_OF_DAWN52, me); + JumpToNextStep(5000); + break; - case 54: - if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) - { - pTemp->SetSpeed(MOVE_RUN, 1.0f); + case 46: // Darion stand up, "not today" + me->SetSpeed(MOVE_RUN, 1.0f); me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); - pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[29].x, LightofDawnLoc[29].y, LightofDawnLoc[29].z); // 26 - } - JumpToNextStep(4000); - break; - - case 55: - if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) - pTemp->SetStandState(UNIT_STAND_STATE_KNEEL); - JumpToNextStep(2000); - break; - - case 56: - if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) - pTemp->SetStandState(UNIT_STAND_STATE_STAND); - JumpToNextStep(1500); - break; - - case 57: - if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) - DoScriptText(SAY_LIGHT_OF_DAWN58, pTemp); - JumpToNextStep(10000); - break; - - case 58: - if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) - DoScriptText(SAY_LIGHT_OF_DAWN59, pTemp); - JumpToNextStep(10000); - break; - - case 59: - if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) - pTemp->CastSpell(pTemp, SPELL_TELEPORT_VISUAL, false); - if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) // Tirion runs to Darion - { - pTemp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); - pTemp->SetSpeed(MOVE_RUN, 1.0f); - pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[6].x, LightofDawnLoc[6].y, LightofDawnLoc[6].z); - } - JumpToNextStep(2500); - break; - - case 60: - if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) // Lich king disappears here - { - DoScriptText(EMOTE_LIGHT_OF_DAWN17, pTemp); - pTemp->Kill(pTemp); - } - JumpToNextStep(10000); - break; + me->SetStandState(UNIT_STAND_STATE_STAND); + DoScriptText(SAY_LIGHT_OF_DAWN53, me); + SetHoldState(false); // Darion throws sword + JumpToNextStep(7000); + break; + + case 47: // Ashbringer rebirth + me->SetStandState(UNIT_STAND_STATE_KNEEL); + DoScriptText(EMOTE_LIGHT_OF_DAWN15, me); + if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) + { + pTemp->SetStandState(UNIT_STAND_STATE_STAND); + pTemp->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 0, uint32(EQUIP_HIGHLORD_TIRION_FORDRING)); + pTemp->CastSpell(pTemp, SPELL_REBIRTH_OF_THE_ASHBRINGER, false); + } + JumpToNextStep(1000); + break; + + case 48: // Show the cleansing effect (dawn of light) + //if (GameObject* pGo = me->GetMap()->GetGameObject(uiDawnofLightGUID)) + // pGo->SetPhaseMask(128, true); + me->SummonGameObject(GO_LIGHT_OF_DAWN, 2283.896, -5287.914, 83.066, 0, 0, 0, 0, 0, 30000); + if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) + { + if (pTemp->HasAura(SPELL_REBIRTH_OF_THE_ASHBRINGER, 0)) + pTemp->RemoveAurasDueToSpell(SPELL_REBIRTH_OF_THE_ASHBRINGER); + pTemp->CastSpell(pTemp, 41542, false); // workarounds, light expoded, makes it cool + pTemp->HandleEmoteCommand(EMOTE_ONESHOT_ROAR); + } + if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) + pTemp->InterruptNonMeleeSpells(false); + JumpToNextStep(2500); + break; - case 61: - if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) - DoScriptText(SAY_LIGHT_OF_DAWN60, pTemp); - JumpToNextStep(3000); - break; + case 49: + if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) + DoScriptText(SAY_LIGHT_OF_DAWN54, pTemp); + JumpToNextStep(4000); + break; - case 62: - if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) - { - pTemp->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); - pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[7].x, LightofDawnLoc[7].y, LightofDawnLoc[7].z); - } - JumpToNextStep(5500); - break; + case 50: + if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) + DoScriptText(SAY_LIGHT_OF_DAWN55, pTemp); + JumpToNextStep(5000); + break; + + case 51: + if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) + DoScriptText(SAY_LIGHT_OF_DAWN56, pTemp); + JumpToNextStep(1000); + break; + + case 52: // Tiron charges + if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) + { + DoScriptText(EMOTE_LIGHT_OF_DAWN16, pTemp); + pTemp->CastSpell(pTemp, SPELL_TIRION_CHARGE, false); // jumping charge + pTemp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY2H); + pTemp->SetSpeed(MOVE_RUN, 3.0f); // workarounds, make Tirion still running + pTemp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[2].x, LightofDawnLoc[2].y, LightofDawnLoc[2].z); + if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) + pTemp->Relocate(LightofDawnLoc[28].x, LightofDawnLoc[28].y, LightofDawnLoc[28].z); // workarounds, he should kick back by Tirion, but here we relocate him + } + JumpToNextStep(1500); + break; - case 63: - if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) - { - pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[8].x, LightofDawnLoc[8].y, LightofDawnLoc[8].z); - DoScriptText(SAY_LIGHT_OF_DAWN61, pTemp); - } - JumpToNextStep(15000); - break; - - case 64: - if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) - DoScriptText(SAY_LIGHT_OF_DAWN62, pTemp); - JumpToNextStep(7000); - break; - - case 65: - if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) - DoScriptText(SAY_LIGHT_OF_DAWN63, pTemp); - JumpToNextStep(10000); - break; - - case 66: - if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) - DoScriptText(SAY_LIGHT_OF_DAWN64, pTemp); - JumpToNextStep(11000); - break; - - case 67: - if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) - DoScriptText(SAY_LIGHT_OF_DAWN65, pTemp); - JumpToNextStep(10000); - break; - - case 68: - if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) - DoScriptText(SAY_LIGHT_OF_DAWN66, pTemp); - JumpToNextStep(8000); - break; - - case 69: - if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) - DoScriptText(SAY_LIGHT_OF_DAWN67, pTemp); - JumpToNextStep(10000); - break; - - case 70: - me->SetStandState(UNIT_STAND_STATE_STAND); - DoScriptText(SAY_LIGHT_OF_DAWN68, me); - JumpToNextStep(10000); - break; - - case 71: - //if (GameObject* pGo = me->GetMap()->GetGameObject(uiDawnofLightGUID)) // Turn off dawn of light - // pGo->SetPhaseMask(0, true); + case 53: + if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) + DoScriptText(SAY_LIGHT_OF_DAWN57, pTemp); + JumpToNextStep(1000); + break; - { - Map *map = me->GetMap(); // search players with in 50 yards for quest credit - Map::PlayerList const &PlayerList = map->GetPlayers(); - if (!PlayerList.isEmpty()) + case 54: + if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) { - for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) - if (i->getSource()->isAlive() && me->IsWithinDistInMap(i->getSource(), 50)) - i->getSource()->CastSpell(i->getSource(), SPELL_THE_LIGHT_OF_DAWN_Q, false); + pTemp->SetSpeed(MOVE_RUN, 1.0f); + me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[29].x, LightofDawnLoc[29].y, LightofDawnLoc[29].z); // 26 } - } - me->SetVisibility(VISIBILITY_OFF); // respawns another Darion for quest turn in - me->SummonCreature(NPC_HIGHLORD_DARION_MOGRAINE, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 180000); - JumpToNextStep(1000); - break; - - case 72: - SetHoldState(false); // Escort ends - JumpToNextStep(25000); - break; - - case 73: - me->ForcedDespawn(); - break; - } + JumpToNextStep(4000); + break; - } else uiPhase_timer -= diff; - } + case 55: + if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) + pTemp->SetStandState(UNIT_STAND_STATE_KNEEL); + JumpToNextStep(2000); + break; - // ******* During battle ***************************************************************** - else - { - if (uiAnti_magic_zone <= diff) - { - DoCast(me, SPELL_ANTI_MAGIC_ZONE1); - uiAnti_magic_zone = 25000 + rand()%5000; - } else uiAnti_magic_zone -= diff; + case 56: + if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) + pTemp->SetStandState(UNIT_STAND_STATE_STAND); + JumpToNextStep(1500); + break; - if (uiDeath_strike <= diff) - { - DoCast(me->getVictim(), SPELL_DEATH_STRIKE); - uiDeath_strike = 5000 + rand()%5000; - } else uiDeath_strike -= diff; + case 57: + if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) + DoScriptText(SAY_LIGHT_OF_DAWN58, pTemp); + JumpToNextStep(10000); + break; - if (uiDeath_embrace <= diff) - { - DoCast(me->getVictim(), SPELL_DEATH_EMBRACE); - uiDeath_embrace = 5000 + rand()%5000; - } else uiDeath_embrace -= diff; + case 58: + if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) + DoScriptText(SAY_LIGHT_OF_DAWN59, pTemp); + JumpToNextStep(10000); + break; - if (uiIcy_touch <= diff) - { - DoCast(me->getVictim(), SPELL_ICY_TOUCH1); - uiIcy_touch = 5000 + rand()%5000; - } else uiIcy_touch -= diff; + case 59: + if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) + pTemp->CastSpell(pTemp, SPELL_TELEPORT_VISUAL, false); + if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) // Tirion runs to Darion + { + pTemp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); + pTemp->SetSpeed(MOVE_RUN, 1.0f); + pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[6].x, LightofDawnLoc[6].y, LightofDawnLoc[6].z); + } + JumpToNextStep(2500); + break; - if (uiUnholy_blight <= diff) - { - DoCast(me->getVictim(), SPELL_UNHOLY_BLIGHT); - uiUnholy_blight = 5000 + rand()%5000; - } else uiUnholy_blight -= diff; + case 60: + if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) // Lich king disappears here + { + DoScriptText(EMOTE_LIGHT_OF_DAWN17, pTemp); + pTemp->Kill(pTemp); + } + JumpToNextStep(10000); + break; - if (uiFight_speech <= diff) - { - DoScriptText(RAND(SAY_LIGHT_OF_DAWN09,SAY_LIGHT_OF_DAWN10,SAY_LIGHT_OF_DAWN11, - SAY_LIGHT_OF_DAWN12,SAY_LIGHT_OF_DAWN13,SAY_LIGHT_OF_DAWN14, - SAY_LIGHT_OF_DAWN15,SAY_LIGHT_OF_DAWN16,SAY_LIGHT_OF_DAWN17, - SAY_LIGHT_OF_DAWN18,SAY_LIGHT_OF_DAWN19,SAY_LIGHT_OF_DAWN20, - SAY_LIGHT_OF_DAWN21,SAY_LIGHT_OF_DAWN22,SAY_LIGHT_OF_DAWN23, - SAY_LIGHT_OF_DAWN24), me); - uiFight_speech = 15000 + rand()%5000; - } else uiFight_speech -= diff; - - // Check spawns - if (uiSpawncheck <= diff) - { - SpawnNPC(); - uiSpawncheck = 1000; - } else uiSpawncheck -= diff; + case 61: + if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) + DoScriptText(SAY_LIGHT_OF_DAWN60, pTemp); + JumpToNextStep(3000); + break; - // Check targets - if (uiTargetcheck <= diff) - { - for (uint8 i = 0; i < ENCOUNTER_GHOUL_NUMBER; ++i) - NPCChangeTarget(uiGhoulGUID[i]); - for (uint8 i = 0; i < ENCOUNTER_WARRIOR_NUMBER; ++i) - NPCChangeTarget(uiWarriorGUID[i]); - for (uint8 i = 0; i < ENCOUNTER_ABOMINATION_NUMBER; ++i) - NPCChangeTarget(uiAbominationGUID[i]); - for (uint8 i = 0; i < ENCOUNTER_BEHEMOTH_NUMBER; ++i) - NPCChangeTarget(uiBehemothGUID[i]); - NPCChangeTarget(uiKoltiraGUID); - NPCChangeTarget(uiOrbazGUID); - NPCChangeTarget(uiThassarianGUID); + case 62: + if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) + { + pTemp->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[7].x, LightofDawnLoc[7].y, LightofDawnLoc[7].z); + } + JumpToNextStep(5500); + break; - uiTargetcheck = 10000; - } else uiTargetcheck -= diff; + case 63: + if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) + { + pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[8].x, LightofDawnLoc[8].y, LightofDawnLoc[8].z); + DoScriptText(SAY_LIGHT_OF_DAWN61, pTemp); + } + JumpToNextStep(15000); + break; + + case 64: + if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) + DoScriptText(SAY_LIGHT_OF_DAWN62, pTemp); + JumpToNextStep(7000); + break; + + case 65: + if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) + DoScriptText(SAY_LIGHT_OF_DAWN63, pTemp); + JumpToNextStep(10000); + break; + + case 66: + if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) + DoScriptText(SAY_LIGHT_OF_DAWN64, pTemp); + JumpToNextStep(11000); + break; + + case 67: + if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) + DoScriptText(SAY_LIGHT_OF_DAWN65, pTemp); + JumpToNextStep(10000); + break; + + case 68: + if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) + DoScriptText(SAY_LIGHT_OF_DAWN66, pTemp); + JumpToNextStep(8000); + break; + + case 69: + if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) + DoScriptText(SAY_LIGHT_OF_DAWN67, pTemp); + JumpToNextStep(10000); + break; + + case 70: + me->SetStandState(UNIT_STAND_STATE_STAND); + DoScriptText(SAY_LIGHT_OF_DAWN68, me); + JumpToNextStep(10000); + break; + + case 71: + //if (GameObject* pGo = me->GetMap()->GetGameObject(uiDawnofLightGUID)) // Turn off dawn of light + // pGo->SetPhaseMask(0, true); - // Battle end - if (uiFight_duration <= diff + 5000) - { - if (!uiTirionGUID) - if (Unit* pTemp = me->SummonCreature(NPC_HIGHLORD_TIRION_FORDRING, LightofDawnLoc[0].x, LightofDawnLoc[0].y, LightofDawnLoc[0].z, 1.528, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 600000)) - { - pTemp->setFaction(me->getFaction()); - pTemp->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 0, uint32(EQUIP_UNEQUIP)); - DoScriptText(SAY_LIGHT_OF_DAWN25, pTemp); - uiTirionGUID = pTemp->GetGUID(); + { + Map *map = me->GetMap(); // search players with in 50 yards for quest credit + Map::PlayerList const &PlayerList = map->GetPlayers(); + if (!PlayerList.isEmpty()) + { + for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) + if (i->getSource()->isAlive() && me->IsWithinDistInMap(i->getSource(), 50)) + i->getSource()->CastSpell(i->getSource(), SPELL_THE_LIGHT_OF_DAWN_Q, false); + } + } + me->SetVisibility(VISIBILITY_OFF); // respawns another Darion for quest turn in + me->SummonCreature(NPC_HIGHLORD_DARION_MOGRAINE, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 180000); + JumpToNextStep(1000); + break; + + case 72: + SetHoldState(false); // Escort ends + JumpToNextStep(25000); + break; + + case 73: + me->ForcedDespawn(); + break; } - } - if (uiFight_duration <= diff) - { - bIsBattle = false; - uiFight_duration = 300000; - if (me->HasAura(SPELL_THE_MIGHT_OF_MOGRAINE, 0)) - me->RemoveAurasDueToSpell(SPELL_THE_MIGHT_OF_MOGRAINE); - me->RemoveAllAuras(); - me->DeleteThreatList(); - me->CombatStop(true); - me->InterruptNonMeleeSpells(false); - me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + } else uiPhase_timer -= diff; + } - for (uint8 i = 0; i < ENCOUNTER_DEFENDER_NUMBER; ++i) - DespawnNPC(uiDefenderGUID[i]); - for (uint8 i = 0; i < ENCOUNTER_EARTHSHATTER_NUMBER; ++i) - DespawnNPC(uiEarthshatterGUID[i]); - for (uint8 i = 0; i < ENCOUNTER_ABOMINATION_NUMBER; ++i) - DespawnNPC(uiAbominationGUID[i]); - for (uint8 i = 0; i < ENCOUNTER_BEHEMOTH_NUMBER; ++i) - DespawnNPC(uiBehemothGUID[i]); - for (uint8 i = 0; i < ENCOUNTER_GHOUL_NUMBER; ++i) - DespawnNPC(uiGhoulGUID[i]); - for (uint8 i = 0; i < ENCOUNTER_WARRIOR_NUMBER; ++i) - DespawnNPC(uiWarriorGUID[i]); + // ******* During battle ***************************************************************** + else + { + if (uiAnti_magic_zone <= diff) + { + DoCast(me, SPELL_ANTI_MAGIC_ZONE1); + uiAnti_magic_zone = 25000 + rand()%5000; + } else uiAnti_magic_zone -= diff; - if (Creature* pTemp = Unit::GetCreature(*me, uiKorfaxGUID)) + if (uiDeath_strike <= diff) { - pTemp->RemoveAllAuras(); - pTemp->DeleteThreatList(); - pTemp->CombatStop(true); - pTemp->AttackStop(); - pTemp->setFaction(me->getFaction()); - pTemp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[9].x, LightofDawnLoc[9].y, LightofDawnLoc[9].z); - } + DoCast(me->getVictim(), SPELL_DEATH_STRIKE); + uiDeath_strike = 5000 + rand()%5000; + } else uiDeath_strike -= diff; - if (Creature* pTemp = Unit::GetCreature(*me, uiMaxwellGUID)) + if (uiDeath_embrace <= diff) { - pTemp->RemoveAllAuras(); - pTemp->DeleteThreatList(); - pTemp->CombatStop(true); - pTemp->AttackStop(); - pTemp->setFaction(me->getFaction()); - pTemp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[12].x, LightofDawnLoc[12].y, LightofDawnLoc[12].z); - } + DoCast(me->getVictim(), SPELL_DEATH_EMBRACE); + uiDeath_embrace = 5000 + rand()%5000; + } else uiDeath_embrace -= diff; - if (Creature* pTemp = Unit::GetCreature(*me, uiEligorGUID)) + if (uiIcy_touch <= diff) { - pTemp->RemoveAllAuras(); - pTemp->DeleteThreatList(); - pTemp->CombatStop(true); - pTemp->AttackStop(); - pTemp->setFaction(me->getFaction()); - pTemp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[15].x, LightofDawnLoc[15].y, LightofDawnLoc[15].z); - } - DespawnNPC(uiRayneGUID); + DoCast(me->getVictim(), SPELL_ICY_TOUCH1); + uiIcy_touch = 5000 + rand()%5000; + } else uiIcy_touch -= diff; - if (Creature* pTemp = Unit::GetCreature(*me, uiKoltiraGUID)) + if (uiUnholy_blight <= diff) { - pTemp->RemoveAllAuras(); - pTemp->DeleteThreatList(); - pTemp->CombatStop(true); - pTemp->AttackStop(); - pTemp->setFaction(me->getFaction()); - pTemp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[18].x, LightofDawnLoc[18].y, LightofDawnLoc[18].z); - pTemp->CastSpell(pTemp, SPELL_THE_LIGHT_OF_DAWN, false); - } + DoCast(me->getVictim(), SPELL_UNHOLY_BLIGHT); + uiUnholy_blight = 5000 + rand()%5000; + } else uiUnholy_blight -= diff; - if (Creature* pTemp = Unit::GetCreature(*me, uiOrbazGUID)) - DoScriptText(EMOTE_LIGHT_OF_DAWN04, pTemp); + if (uiFight_speech <= diff) + { + DoScriptText(RAND(SAY_LIGHT_OF_DAWN09,SAY_LIGHT_OF_DAWN10,SAY_LIGHT_OF_DAWN11, + SAY_LIGHT_OF_DAWN12,SAY_LIGHT_OF_DAWN13,SAY_LIGHT_OF_DAWN14, + SAY_LIGHT_OF_DAWN15,SAY_LIGHT_OF_DAWN16,SAY_LIGHT_OF_DAWN17, + SAY_LIGHT_OF_DAWN18,SAY_LIGHT_OF_DAWN19,SAY_LIGHT_OF_DAWN20, + SAY_LIGHT_OF_DAWN21,SAY_LIGHT_OF_DAWN22,SAY_LIGHT_OF_DAWN23, + SAY_LIGHT_OF_DAWN24), me); + uiFight_speech = 15000 + rand()%5000; + } else uiFight_speech -= diff; + + // Check spawns + if (uiSpawncheck <= diff) + { + SpawnNPC(); + uiSpawncheck = 1000; + } else uiSpawncheck -= diff; - if (Creature* pTemp = Unit::GetCreature(*me, uiThassarianGUID)) + // Check targets + if (uiTargetcheck <= diff) + { + for (uint8 i = 0; i < ENCOUNTER_GHOUL_NUMBER; ++i) + NPCChangeTarget(uiGhoulGUID[i]); + for (uint8 i = 0; i < ENCOUNTER_WARRIOR_NUMBER; ++i) + NPCChangeTarget(uiWarriorGUID[i]); + for (uint8 i = 0; i < ENCOUNTER_ABOMINATION_NUMBER; ++i) + NPCChangeTarget(uiAbominationGUID[i]); + for (uint8 i = 0; i < ENCOUNTER_BEHEMOTH_NUMBER; ++i) + NPCChangeTarget(uiBehemothGUID[i]); + NPCChangeTarget(uiKoltiraGUID); + NPCChangeTarget(uiOrbazGUID); + NPCChangeTarget(uiThassarianGUID); + + uiTargetcheck = 10000; + } else uiTargetcheck -= diff; + + // Battle end + if (uiFight_duration <= diff + 5000) { - pTemp->RemoveAllAuras(); - pTemp->DeleteThreatList(); - pTemp->CombatStop(true); - pTemp->AttackStop(); - pTemp->setFaction(me->getFaction()); - pTemp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[20].x, LightofDawnLoc[20].y, LightofDawnLoc[20].z); - pTemp->CastSpell(pTemp, SPELL_THE_LIGHT_OF_DAWN, false); + if (!uiTirionGUID) + if (Unit* pTemp = me->SummonCreature(NPC_HIGHLORD_TIRION_FORDRING, LightofDawnLoc[0].x, LightofDawnLoc[0].y, LightofDawnLoc[0].z, 1.528, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 600000)) + { + pTemp->setFaction(me->getFaction()); + pTemp->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 0, uint32(EQUIP_UNEQUIP)); + DoScriptText(SAY_LIGHT_OF_DAWN25, pTemp); + uiTirionGUID = pTemp->GetGUID(); + } } + if (uiFight_duration <= diff) + { + bIsBattle = false; + uiFight_duration = 300000; + + if (me->HasAura(SPELL_THE_MIGHT_OF_MOGRAINE, 0)) + me->RemoveAurasDueToSpell(SPELL_THE_MIGHT_OF_MOGRAINE); + me->RemoveAllAuras(); + me->DeleteThreatList(); + me->CombatStop(true); + me->InterruptNonMeleeSpells(false); + me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + + for (uint8 i = 0; i < ENCOUNTER_DEFENDER_NUMBER; ++i) + DespawnNPC(uiDefenderGUID[i]); + for (uint8 i = 0; i < ENCOUNTER_EARTHSHATTER_NUMBER; ++i) + DespawnNPC(uiEarthshatterGUID[i]); + for (uint8 i = 0; i < ENCOUNTER_ABOMINATION_NUMBER; ++i) + DespawnNPC(uiAbominationGUID[i]); + for (uint8 i = 0; i < ENCOUNTER_BEHEMOTH_NUMBER; ++i) + DespawnNPC(uiBehemothGUID[i]); + for (uint8 i = 0; i < ENCOUNTER_GHOUL_NUMBER; ++i) + DespawnNPC(uiGhoulGUID[i]); + for (uint8 i = 0; i < ENCOUNTER_WARRIOR_NUMBER; ++i) + DespawnNPC(uiWarriorGUID[i]); + + if (Creature* pTemp = Unit::GetCreature(*me, uiKorfaxGUID)) + { + pTemp->RemoveAllAuras(); + pTemp->DeleteThreatList(); + pTemp->CombatStop(true); + pTemp->AttackStop(); + pTemp->setFaction(me->getFaction()); + pTemp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[9].x, LightofDawnLoc[9].y, LightofDawnLoc[9].z); + } - if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) - DoScriptText(SAY_LIGHT_OF_DAWN26, pTemp); - - SetHoldState(false); + if (Creature* pTemp = Unit::GetCreature(*me, uiMaxwellGUID)) + { + pTemp->RemoveAllAuras(); + pTemp->DeleteThreatList(); + pTemp->CombatStop(true); + pTemp->AttackStop(); + pTemp->setFaction(me->getFaction()); + pTemp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[12].x, LightofDawnLoc[12].y, LightofDawnLoc[12].z); + } - } else uiFight_duration -= diff; + if (Creature* pTemp = Unit::GetCreature(*me, uiEligorGUID)) + { + pTemp->RemoveAllAuras(); + pTemp->DeleteThreatList(); + pTemp->CombatStop(true); + pTemp->AttackStop(); + pTemp->setFaction(me->getFaction()); + pTemp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[15].x, LightofDawnLoc[15].y, LightofDawnLoc[15].z); + } + DespawnNPC(uiRayneGUID); - DoMeleeAttackIfReady(); - } - } + if (Creature* pTemp = Unit::GetCreature(*me, uiKoltiraGUID)) + { + pTemp->RemoveAllAuras(); + pTemp->DeleteThreatList(); + pTemp->CombatStop(true); + pTemp->AttackStop(); + pTemp->setFaction(me->getFaction()); + pTemp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[18].x, LightofDawnLoc[18].y, LightofDawnLoc[18].z); + pTemp->CastSpell(pTemp, SPELL_THE_LIGHT_OF_DAWN, false); + } - void JumpToNextStep(uint32 uiTimer) - { - uiPhase_timer = uiTimer; - ++uiStep; - } + if (Creature* pTemp = Unit::GetCreature(*me, uiOrbazGUID)) + DoScriptText(EMOTE_LIGHT_OF_DAWN04, pTemp); - void NPCChangeTarget(uint64 ui_GUID) - { - if (Creature* pTemp = Unit::GetCreature(*me, ui_GUID)) - if (pTemp->isAlive()) - if (Unit* pTarger = SelectUnit(SELECT_TARGET_RANDOM,0)) - if (pTarger->isAlive()) + if (Creature* pTemp = Unit::GetCreature(*me, uiThassarianGUID)) { - // pTemp->DeleteThreatList(); - pTemp->AddThreat(pTarger, 0.0f); - pTemp->AI()->AttackStart(pTarger); - pTemp->SetInCombatWith(pTarger); - pTarger->SetInCombatWith(pTemp); - // pTemp->GetMotionMaster()->MoveChase(pTarger, 20.0f); + pTemp->RemoveAllAuras(); + pTemp->DeleteThreatList(); + pTemp->CombatStop(true); + pTemp->AttackStop(); + pTemp->setFaction(me->getFaction()); + pTemp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[20].x, LightofDawnLoc[20].y, LightofDawnLoc[20].z); + pTemp->CastSpell(pTemp, SPELL_THE_LIGHT_OF_DAWN, false); } - } - void SpawnNPC() - { - Unit* pTemp = NULL; + if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) + DoScriptText(SAY_LIGHT_OF_DAWN26, pTemp); - // Death - for (uint8 i = 0; i < ENCOUNTER_GHOUL_NUMBER; ++i) - { - pTemp = Unit::GetCreature(*me, uiGhoulGUID[i]); - if (!pTemp) - { - pTemp = me->SummonCreature(NPC_ACHERUS_GHOUL, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000); - pTemp->setFaction(2084); - uiGhoulGUID[i] = pTemp->GetGUID(); + SetHoldState(false); + + } else uiFight_duration -= diff; + + DoMeleeAttackIfReady(); } } - for (uint8 i = 0; i < ENCOUNTER_ABOMINATION_NUMBER; ++i) + + void JumpToNextStep(uint32 uiTimer) { - pTemp = Unit::GetCreature(*me, uiAbominationGUID[i]); - if (!pTemp) - { - pTemp = me->SummonCreature(NPC_WARRIOR_OF_THE_FROZEN_WASTES, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000); - pTemp->setFaction(2084); - uiAbominationGUID[i] = pTemp->GetGUID(); - } + uiPhase_timer = uiTimer; + ++uiStep; } - for (uint8 i = 0; i < ENCOUNTER_WARRIOR_NUMBER; ++i) + + void NPCChangeTarget(uint64 ui_GUID) { - pTemp = Unit::GetCreature(*me, uiWarriorGUID[i]); + if (Creature* pTemp = Unit::GetCreature(*me, ui_GUID)) + if (pTemp->isAlive()) + if (Unit* pTarger = SelectUnit(SELECT_TARGET_RANDOM,0)) + if (pTarger->isAlive()) + { + // pTemp->DeleteThreatList(); + pTemp->AddThreat(pTarger, 0.0f); + pTemp->AI()->AttackStart(pTarger); + pTemp->SetInCombatWith(pTarger); + pTarger->SetInCombatWith(pTemp); + // pTemp->GetMotionMaster()->MoveChase(pTarger, 20.0f); + } + } + + void SpawnNPC() + { + Unit* pTemp = NULL; + + // Death + for (uint8 i = 0; i < ENCOUNTER_GHOUL_NUMBER; ++i) + { + pTemp = Unit::GetCreature(*me, uiGhoulGUID[i]); + if (!pTemp) + { + pTemp = me->SummonCreature(NPC_ACHERUS_GHOUL, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000); + pTemp->setFaction(2084); + uiGhoulGUID[i] = pTemp->GetGUID(); + } + } + for (uint8 i = 0; i < ENCOUNTER_ABOMINATION_NUMBER; ++i) + { + pTemp = Unit::GetCreature(*me, uiAbominationGUID[i]); + if (!pTemp) + { + pTemp = me->SummonCreature(NPC_WARRIOR_OF_THE_FROZEN_WASTES, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000); + pTemp->setFaction(2084); + uiAbominationGUID[i] = pTemp->GetGUID(); + } + } + for (uint8 i = 0; i < ENCOUNTER_WARRIOR_NUMBER; ++i) + { + pTemp = Unit::GetCreature(*me, uiWarriorGUID[i]); + if (!pTemp) + { + pTemp = me->SummonCreature(NPC_RAMPAGING_ABOMINATION, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000); + pTemp->setFaction(2084); + uiWarriorGUID[i] = pTemp->GetGUID(); + } + } + for (uint8 i = 0; i < ENCOUNTER_BEHEMOTH_NUMBER; ++i) + { + pTemp = Unit::GetCreature(*me, uiBehemothGUID[i]); + if (!pTemp) + { + pTemp = me->SummonCreature(NPC_FLESH_BEHEMOTH, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000); + pTemp->setFaction(2084); + uiBehemothGUID[i] = pTemp->GetGUID(); + } + } + + // Dawn + for (uint8 i = 0; i < ENCOUNTER_DEFENDER_NUMBER; ++i) + { + pTemp = Unit::GetCreature(*me, uiDefenderGUID[i]); + if (!pTemp) + { + pTemp = me->SummonCreature(NPC_DEFENDER_OF_THE_LIGHT, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000); + pTemp->setFaction(2089); + me->AddThreat(pTemp, 0.0f); + uiDefenderGUID[i] = pTemp->GetGUID(); + } + } + for (uint8 i = 0; i < ENCOUNTER_EARTHSHATTER_NUMBER; ++i) + { + pTemp = Unit::GetCreature(*me, uiEarthshatterGUID[i]); + if (!pTemp) + { + pTemp = me->SummonCreature(NPC_RIMBLAT_EARTHSHATTER, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000); + pTemp->setFaction(2089); + me->AddThreat(pTemp, 0.0f); + uiEarthshatterGUID[i] = pTemp->GetGUID(); + } + } + pTemp = Unit::GetCreature(*me, uiKorfaxGUID); if (!pTemp) { - pTemp = me->SummonCreature(NPC_RAMPAGING_ABOMINATION, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000); - pTemp->setFaction(2084); - uiWarriorGUID[i] = pTemp->GetGUID(); + pTemp = me->SummonCreature(NPC_KORFAX_CHAMPION_OF_THE_LIGHT, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 600000); + pTemp->setFaction(2089); + me->AddThreat(pTemp, 0.0f); + uiKorfaxGUID = pTemp->GetGUID(); } - } - for (uint8 i = 0; i < ENCOUNTER_BEHEMOTH_NUMBER; ++i) - { - pTemp = Unit::GetCreature(*me, uiBehemothGUID[i]); + pTemp = Unit::GetCreature(*me, uiMaxwellGUID); if (!pTemp) { - pTemp = me->SummonCreature(NPC_FLESH_BEHEMOTH, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000); - pTemp->setFaction(2084); - uiBehemothGUID[i] = pTemp->GetGUID(); + pTemp = me->SummonCreature(NPC_LORD_MAXWELL_TYROSUS, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 600000); + pTemp->setFaction(2089); + me->AddThreat(pTemp, 0.0f); + uiMaxwellGUID = pTemp->GetGUID(); } - } - - // Dawn - for (uint8 i = 0; i < ENCOUNTER_DEFENDER_NUMBER; ++i) - { - pTemp = Unit::GetCreature(*me, uiDefenderGUID[i]); + pTemp = Unit::GetCreature(*me, uiEligorGUID); if (!pTemp) { - pTemp = me->SummonCreature(NPC_DEFENDER_OF_THE_LIGHT, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000); + pTemp = me->SummonCreature(NPC_COMMANDER_ELIGOR_DAWNBRINGER, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 600000); pTemp->setFaction(2089); me->AddThreat(pTemp, 0.0f); - uiDefenderGUID[i] = pTemp->GetGUID(); + uiEligorGUID = pTemp->GetGUID(); } - } - for (uint8 i = 0; i < ENCOUNTER_EARTHSHATTER_NUMBER; ++i) - { - pTemp = Unit::GetCreature(*me, uiEarthshatterGUID[i]); + pTemp = Unit::GetCreature(*me, uiRayneGUID); if (!pTemp) { - pTemp = me->SummonCreature(NPC_RIMBLAT_EARTHSHATTER, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000); + pTemp = me->SummonCreature(NPC_RAYNE, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000); pTemp->setFaction(2089); me->AddThreat(pTemp, 0.0f); - uiEarthshatterGUID[i] = pTemp->GetGUID(); + uiRayneGUID = pTemp->GetGUID(); } } - pTemp = Unit::GetCreature(*me, uiKorfaxGUID); - if (!pTemp) - { - pTemp = me->SummonCreature(NPC_KORFAX_CHAMPION_OF_THE_LIGHT, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 600000); - pTemp->setFaction(2089); - me->AddThreat(pTemp, 0.0f); - uiKorfaxGUID = pTemp->GetGUID(); - } - pTemp = Unit::GetCreature(*me, uiMaxwellGUID); - if (!pTemp) - { - pTemp = me->SummonCreature(NPC_LORD_MAXWELL_TYROSUS, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 600000); - pTemp->setFaction(2089); - me->AddThreat(pTemp, 0.0f); - uiMaxwellGUID = pTemp->GetGUID(); - } - pTemp = Unit::GetCreature(*me, uiEligorGUID); - if (!pTemp) - { - pTemp = me->SummonCreature(NPC_COMMANDER_ELIGOR_DAWNBRINGER, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 600000); - pTemp->setFaction(2089); - me->AddThreat(pTemp, 0.0f); - uiEligorGUID = pTemp->GetGUID(); - } - pTemp = Unit::GetCreature(*me, uiRayneGUID); - if (!pTemp) + + void DespawnNPC(uint64 pGUID) { - pTemp = me->SummonCreature(NPC_RAYNE, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000); - pTemp->setFaction(2089); - me->AddThreat(pTemp, 0.0f); - uiRayneGUID = pTemp->GetGUID(); + if (Creature* pTemp = Unit::GetCreature(*me, pGUID)) + if (pTemp->isAlive()) + { + pTemp->SetVisibility(VISIBILITY_OFF); + pTemp->Kill(pTemp); + } } - } + }; - void DespawnNPC(uint64 pGUID) - { - if (Creature* pTemp = Unit::GetCreature(*me, pGUID)) - if (pTemp->isAlive()) - { - pTemp->SetVisibility(VISIBILITY_OFF); - pTemp->Kill(pTemp); - } - } }; -bool GossipHello_npc_highlord_darion_mograine(Player* pPlayer, Creature* pCreature) -{ - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - - if (pPlayer->GetQuestStatus(12801) == QUEST_STATUS_INCOMPLETE) - pPlayer->ADD_GOSSIP_ITEM(0, "I am ready.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - return true; -} -bool GossipSelect_npc_highlord_darion_mograine(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) +/*###### +## npc the lich king in dawn of light +######*/
class npc_the_lich_king_tirion_dawn : public CreatureScript { - switch (uiAction) +public: + npc_the_lich_king_tirion_dawn() : CreatureScript("npc_the_lich_king_tirion_dawn") { } + + CreatureAI* GetAI(Creature* pCreature) const { - case GOSSIP_ACTION_INFO_DEF+1: - pPlayer->CLOSE_GOSSIP_MENU(); - CAST_AI(npc_highlord_darion_mograineAI, pCreature->AI())->uiStep = 1; - CAST_AI(npc_highlord_darion_mograineAI, pCreature->AI())->Start(true, false, pPlayer->GetGUID()); - break; + return new npc_the_lich_king_tirion_dawnAI (pCreature); } - return true; -} -/*###### -## npc the lich king in dawn of light -######*/ -struct npc_the_lich_king_tirion_dawnAI : public ScriptedAI -{ - npc_the_lich_king_tirion_dawnAI(Creature* pCreature) : ScriptedAI(pCreature) { Reset(); } - void Reset() {} - void AttackStart(Unit * /*who*/) {} // very sample, just don't make them aggreesive - void UpdateAI(const uint32 /*diff*/) {} - void JustDied(Unit* /*killer*/) {} + struct npc_the_lich_king_tirion_dawnAI : public ScriptedAI + { + npc_the_lich_king_tirion_dawnAI(Creature* pCreature) : ScriptedAI(pCreature) { Reset(); } + void Reset() {} + void AttackStart(Unit * /*who*/) {} // very sample, just don't make them aggreesive + void UpdateAI(const uint32 /*diff*/) {} + void JustDied(Unit* /*killer*/) {} + }; + }; -CreatureAI* GetAI_npc_highlord_darion_mograine(Creature* pCreature) -{ - return new npc_highlord_darion_mograineAI(pCreature); -} -CreatureAI* GetAI_npc_the_lich_king_tirion_dawn(Creature* pCreature) -{ - return new npc_the_lich_king_tirion_dawnAI (pCreature); -} void AddSC_the_scarlet_enclave_c5() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_highlord_darion_mograine"; - newscript->GetAI = &GetAI_npc_highlord_darion_mograine; - newscript->pGossipHello = &GossipHello_npc_highlord_darion_mograine; - newscript->pGossipSelect = &GossipSelect_npc_highlord_darion_mograine; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_the_lich_king_tirion_dawn"; - newscript->GetAI = &GetAI_npc_the_lich_king_tirion_dawn; - newscript->RegisterSelf(); + new npc_highlord_darion_mograine(); + new npc_the_lich_king_tirion_dawn(); } diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/the_scarlet_enclave.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/the_scarlet_enclave.cpp index 0a4f02c2e62..35d7baec4a3 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/the_scarlet_enclave.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/the_scarlet_enclave.cpp @@ -22,97 +22,96 @@ ####*/ #define SPELL_REVIVE 51918 #define VALK_WHISPER "It is not yet your time, champion. Rise! Rise and fight once more!" - -struct npc_valkyr_battle_maidenAI : public PassiveAI +
class npc_valkyr_battle_maiden : public CreatureScript { - npc_valkyr_battle_maidenAI(Creature *c) : PassiveAI(c) {} - - uint32 FlyBackTimer; - float x, y, z; - uint32 phase; +public: + npc_valkyr_battle_maiden() : CreatureScript("npc_valkyr_battle_maiden") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - me->setActive(true); - me->SetVisibility(VISIBILITY_OFF); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->SetFlying(true); - FlyBackTimer = 500; - phase = 0; - - me->GetPosition(x, y, z); - z += 4; x -= 3.5; y -= 5; - me->GetMotionMaster()->Clear(false); - me->GetMap()->CreatureRelocation(me, x, y, z, 0.0f); + return new npc_valkyr_battle_maidenAI (pCreature); } - void UpdateAI(const uint32 diff) + struct npc_valkyr_battle_maidenAI : public PassiveAI { - if (FlyBackTimer <= diff) + npc_valkyr_battle_maidenAI(Creature *c) : PassiveAI(c) {} + + uint32 FlyBackTimer; + float x, y, z; + uint32 phase; + + void Reset() { - Player *plr = NULL; - if (me->isSummon()) - if (Unit *summoner = CAST_SUM(me)->GetSummoner()) - if (summoner->GetTypeId() == TYPEID_PLAYER) - plr = CAST_PLR(summoner); + me->setActive(true); + me->SetVisibility(VISIBILITY_OFF); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->SetFlying(true); + FlyBackTimer = 500; + phase = 0; - if (!plr) - phase = 3; + me->GetPosition(x, y, z); + z += 4; x -= 3.5; y -= 5; + me->GetMotionMaster()->Clear(false); + me->GetMap()->CreatureRelocation(me, x, y, z, 0.0f); + } - switch(phase) + void UpdateAI(const uint32 diff) + { + if (FlyBackTimer <= diff) { - case 0: - me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - me->HandleEmoteCommand(EMOTE_STATE_FLYGRABCLOSED); - FlyBackTimer = 500; - break; - case 1: - plr->GetClosePoint(x,y,z, me->GetObjectSize()); - z += 2.5; x -= 2; y -= 1.5; - me->GetMotionMaster()->MovePoint(0, x, y, z); - me->SetUInt64Value(UNIT_FIELD_TARGET, plr->GetGUID()); - me->SetVisibility(VISIBILITY_ON); - FlyBackTimer = 4500; - break; - case 2: - if (!plr->isRessurectRequested()) - { - me->HandleEmoteCommand(EMOTE_ONESHOT_CUSTOMSPELL01); - DoCast(plr, SPELL_REVIVE, true); - me->MonsterWhisper(VALK_WHISPER, plr->GetGUID()); - } - FlyBackTimer = 5000; - break; - case 3: - me->SetVisibility(VISIBILITY_OFF); - FlyBackTimer = 3000; - break; - case 4: - me->DisappearAndDie(); - break; - default: - //Nothing To DO - break; - } - ++phase; - } else FlyBackTimer-=diff; - } + Player *plr = NULL; + if (me->isSummon()) + if (Unit *summoner = CAST_SUM(me)->GetSummoner()) + if (summoner->GetTypeId() == TYPEID_PLAYER) + plr = CAST_PLR(summoner); + + if (!plr) + phase = 3; + + switch(phase) + { + case 0: + me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + me->HandleEmoteCommand(EMOTE_STATE_FLYGRABCLOSED); + FlyBackTimer = 500; + break; + case 1: + plr->GetClosePoint(x,y,z, me->GetObjectSize()); + z += 2.5; x -= 2; y -= 1.5; + me->GetMotionMaster()->MovePoint(0, x, y, z); + me->SetUInt64Value(UNIT_FIELD_TARGET, plr->GetGUID()); + me->SetVisibility(VISIBILITY_ON); + FlyBackTimer = 4500; + break; + case 2: + if (!plr->isRessurectRequested()) + { + me->HandleEmoteCommand(EMOTE_ONESHOT_CUSTOMSPELL01); + DoCast(plr, SPELL_REVIVE, true); + me->MonsterWhisper(VALK_WHISPER, plr->GetGUID()); + } + FlyBackTimer = 5000; + break; + case 3: + me->SetVisibility(VISIBILITY_OFF); + FlyBackTimer = 3000; + break; + case 4: + me->DisappearAndDie(); + break; + default: + //Nothing To DO + break; + } + ++phase; + } else FlyBackTimer-=diff; + } + }; + }; -CreatureAI* GetAI_npc_valkyr_battle_maiden(Creature* pCreature) -{ - return new npc_valkyr_battle_maidenAI (pCreature); -} void AddSC_the_scarlet_enclave() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_valkyr_battle_maiden"; - newscript->GetAI = &GetAI_npc_valkyr_battle_maiden; - newscript->RegisterSelf(); - - // Chapter 3: Scarlet Armies Approach... - An End To All Things... - // Chapter 4: An End To All Things... - An End To All Things... + new npc_valkyr_battle_maiden(); } diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_arcanist_doan.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_arcanist_doan.cpp index 6659d1aaba8..98c30dfdc2f 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_arcanist_doan.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_arcanist_doan.cpp @@ -36,95 +36,97 @@ enum eEnums SPELL_FIREAOE = 9435, SPELL_ARCANEBUBBLE = 9438, }; - -struct boss_arcanist_doanAI : public ScriptedAI +
class boss_arcanist_doan : public CreatureScript { - boss_arcanist_doanAI(Creature *c) : ScriptedAI(c) {} - - uint32 Polymorph_Timer; - uint32 AoESilence_Timer; - uint32 ArcaneExplosion_Timer; - bool bCanDetonate; - bool bShielded; +public: + boss_arcanist_doan() : CreatureScript("boss_arcanist_doan") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - Polymorph_Timer = 20000; - AoESilence_Timer = 15000; - ArcaneExplosion_Timer = 3000; - bCanDetonate = false; - bShielded = false; + return new boss_arcanist_doanAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_arcanist_doanAI : public ScriptedAI { - DoScriptText(SAY_AGGRO, me); - } + boss_arcanist_doanAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + uint32 Polymorph_Timer; + uint32 AoESilence_Timer; + uint32 ArcaneExplosion_Timer; + bool bCanDetonate; + bool bShielded; - if (bShielded && bCanDetonate) + void Reset() { - DoCast(me, SPELL_FIREAOE); + Polymorph_Timer = 20000; + AoESilence_Timer = 15000; + ArcaneExplosion_Timer = 3000; bCanDetonate = false; + bShielded = false; } - if (me->HasAura(SPELL_ARCANEBUBBLE)) - return; - - //If we are <50% hp cast Arcane Bubble - if (!bShielded && me->GetHealth()*100 / me->GetMaxHealth() <= 50) + void EnterCombat(Unit * /*who*/) { - //wait if we already casting - if (me->IsNonMeleeSpellCasted(false)) - return; - - DoScriptText(SAY_SPECIALAE, me); - DoCast(me, SPELL_ARCANEBUBBLE); - - bCanDetonate = true; - bShielded = true; + DoScriptText(SAY_AGGRO, me); } - if (Polymorph_Timer <= diff) + void UpdateAI(const uint32 diff) { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,1)) - DoCast(pTarget, SPELL_POLYMORPH); + if (!UpdateVictim()) + return; - Polymorph_Timer = 20000; - } else Polymorph_Timer -= diff; + if (bShielded && bCanDetonate) + { + DoCast(me, SPELL_FIREAOE); + bCanDetonate = false; + } - //AoESilence_Timer - if (AoESilence_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_AOESILENCE); - AoESilence_Timer = 15000 + rand()%5000; - } else AoESilence_Timer -= diff; + if (me->HasAura(SPELL_ARCANEBUBBLE)) + return; - //ArcaneExplosion_Timer - if (ArcaneExplosion_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_ARCANEEXPLOSION); - ArcaneExplosion_Timer = 8000; - } else ArcaneExplosion_Timer -= diff; + //If we are <50% hp cast Arcane Bubble + if (!bShielded && me->GetHealth()*100 / me->GetMaxHealth() <= 50) + { + //wait if we already casting + if (me->IsNonMeleeSpellCasted(false)) + return; + + DoScriptText(SAY_SPECIALAE, me); + DoCast(me, SPELL_ARCANEBUBBLE); + + bCanDetonate = true; + bShielded = true; + } + + if (Polymorph_Timer <= diff) + { + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,1)) + DoCast(pTarget, SPELL_POLYMORPH); + + Polymorph_Timer = 20000; + } else Polymorph_Timer -= diff; + + //AoESilence_Timer + if (AoESilence_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_AOESILENCE); + AoESilence_Timer = 15000 + rand()%5000; + } else AoESilence_Timer -= diff; + + //ArcaneExplosion_Timer + if (ArcaneExplosion_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_ARCANEEXPLOSION); + ArcaneExplosion_Timer = 8000; + } else ArcaneExplosion_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_arcanist_doan(Creature* pCreature) -{ - return new boss_arcanist_doanAI (pCreature); -} void AddSC_boss_arcanist_doan() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_arcanist_doan"; - newscript->GetAI = &GetAI_boss_arcanist_doan; - newscript->RegisterSelf(); + new boss_arcanist_doan(); } - diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_azshir_the_sleepless.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_azshir_the_sleepless.cpp index e30e527d567..d687a7da0d2 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_azshir_the_sleepless.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_azshir_the_sleepless.cpp @@ -28,73 +28,75 @@ EndScriptData */ #define SPELL_CALLOFTHEGRAVE 17831 #define SPELL_TERRIFY 7399 #define SPELL_SOULSIPHON 7290 - -struct boss_azshir_the_sleeplessAI : public ScriptedAI +
class boss_azshir_the_sleepless : public CreatureScript { - boss_azshir_the_sleeplessAI(Creature *c) : ScriptedAI(c) {} - - uint32 SoulSiphon_Timer; - uint32 CallOftheGrave_Timer; - uint32 Terrify_Timer; +public: + boss_azshir_the_sleepless() : CreatureScript("boss_azshir_the_sleepless") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - SoulSiphon_Timer = 1; - CallOftheGrave_Timer = 30000; - Terrify_Timer = 20000; + return new boss_azshir_the_sleeplessAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_azshir_the_sleeplessAI : public ScriptedAI { - } + boss_azshir_the_sleeplessAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + uint32 SoulSiphon_Timer; + uint32 CallOftheGrave_Timer; + uint32 Terrify_Timer; - //If we are <50% hp cast Soul Siphon rank 1 - if (me->GetHealth()*100 / me->GetMaxHealth() <= 50 && !me->IsNonMeleeSpellCasted(false)) + void Reset() { - //SoulSiphon_Timer - if (SoulSiphon_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_SOULSIPHON); - return; - - //SoulSiphon_Timer = 20000; - } else SoulSiphon_Timer -= diff; + SoulSiphon_Timer = 1; + CallOftheGrave_Timer = 30000; + Terrify_Timer = 20000; } - //CallOfTheGrave_Timer - if (CallOftheGrave_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - DoCast(me->getVictim(), SPELL_CALLOFTHEGRAVE); - CallOftheGrave_Timer = 30000; - } else CallOftheGrave_Timer -= diff; + } - //Terrify_Timer - if (Terrify_Timer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_TERRIFY); - Terrify_Timer = 20000; - } else Terrify_Timer -= diff; + if (!UpdateVictim()) + return; + + //If we are <50% hp cast Soul Siphon rank 1 + if (me->GetHealth()*100 / me->GetMaxHealth() <= 50 && !me->IsNonMeleeSpellCasted(false)) + { + //SoulSiphon_Timer + if (SoulSiphon_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_SOULSIPHON); + return; + + //SoulSiphon_Timer = 20000; + } else SoulSiphon_Timer -= diff; + } + + //CallOfTheGrave_Timer + if (CallOftheGrave_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_CALLOFTHEGRAVE); + CallOftheGrave_Timer = 30000; + } else CallOftheGrave_Timer -= diff; + + //Terrify_Timer + if (Terrify_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_TERRIFY); + Terrify_Timer = 20000; + } else Terrify_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_azshir_the_sleepless(Creature* pCreature) -{ - return new boss_azshir_the_sleeplessAI (pCreature); -} void AddSC_boss_azshir_the_sleepless() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_azshir_the_sleepless"; - newscript->GetAI = &GetAI_boss_azshir_the_sleepless; - newscript->RegisterSelf(); + new boss_azshir_the_sleepless(); } - diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_bloodmage_thalnos.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_bloodmage_thalnos.cpp index 2a53ce591db..131e74e5b99 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_bloodmage_thalnos.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_bloodmage_thalnos.cpp @@ -36,91 +36,93 @@ enum eEnums SPELL_FLAMESPIKE = 8814, SPELL_FIRENOVA = 16079, }; - -struct boss_bloodmage_thalnosAI : public ScriptedAI +
class boss_bloodmage_thalnos : public CreatureScript { - boss_bloodmage_thalnosAI(Creature *c) : ScriptedAI(c) {} - - bool HpYell; - uint32 FlameShock_Timer; - uint32 ShadowBolt_Timer; - uint32 FlameSpike_Timer; - uint32 FireNova_Timer; - - void Reset() - { - HpYell = false; - FlameShock_Timer = 10000; - ShadowBolt_Timer = 2000; - FlameSpike_Timer = 8000; - FireNova_Timer = 40000; - } +public: + boss_bloodmage_thalnos() : CreatureScript("boss_bloodmage_thalnos") { } - void EnterCombat(Unit * /*who*/) + CreatureAI* GetAI(Creature* pCreature) const { - DoScriptText(SAY_AGGRO, me); + return new boss_bloodmage_thalnosAI (pCreature); } - void KilledUnit(Unit* /*Victim*/) + struct boss_bloodmage_thalnosAI : public ScriptedAI { - DoScriptText(SAY_KILL, me); - } + boss_bloodmage_thalnosAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + bool HpYell; + uint32 FlameShock_Timer; + uint32 ShadowBolt_Timer; + uint32 FlameSpike_Timer; + uint32 FireNova_Timer; - //If we are <35% hp - if (!HpYell && ((me->GetHealth()*100) / me->GetMaxHealth() <= 35)) + void Reset() { - DoScriptText(SAY_HEALTH, me); - HpYell = true; + HpYell = false; + FlameShock_Timer = 10000; + ShadowBolt_Timer = 2000; + FlameSpike_Timer = 8000; + FireNova_Timer = 40000; } - //FlameShock_Timer - if (FlameShock_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_FLAMESHOCK); - FlameShock_Timer = 10000 + rand()%5000; - } else FlameShock_Timer -= diff; - - //FlameSpike_Timer - if (FlameSpike_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - DoCast(me->getVictim(), SPELL_FLAMESPIKE); - FlameSpike_Timer = 30000; - } else FlameSpike_Timer -= diff; + DoScriptText(SAY_AGGRO, me); + } - //FireNova_Timer - if (FireNova_Timer <= diff) + void KilledUnit(Unit* /*Victim*/) { - DoCast(me->getVictim(), SPELL_FIRENOVA); - FireNova_Timer = 40000; - } else FireNova_Timer -= diff; + DoScriptText(SAY_KILL, me); + } - //ShadowBolt_Timer - if (ShadowBolt_Timer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_SHADOWBOLT); - ShadowBolt_Timer = 2000; - } else ShadowBolt_Timer -= diff; + if (!UpdateVictim()) + return; + + //If we are <35% hp + if (!HpYell && ((me->GetHealth()*100) / me->GetMaxHealth() <= 35)) + { + DoScriptText(SAY_HEALTH, me); + HpYell = true; + } + + //FlameShock_Timer + if (FlameShock_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_FLAMESHOCK); + FlameShock_Timer = 10000 + rand()%5000; + } else FlameShock_Timer -= diff; + + //FlameSpike_Timer + if (FlameSpike_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_FLAMESPIKE); + FlameSpike_Timer = 30000; + } else FlameSpike_Timer -= diff; + + //FireNova_Timer + if (FireNova_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_FIRENOVA); + FireNova_Timer = 40000; + } else FireNova_Timer -= diff; + + //ShadowBolt_Timer + if (ShadowBolt_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_SHADOWBOLT); + ShadowBolt_Timer = 2000; + } else ShadowBolt_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_bloodmage_thalnos(Creature* pCreature) -{ - return new boss_bloodmage_thalnosAI (pCreature); -} void AddSC_boss_bloodmage_thalnos() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_bloodmage_thalnos"; - newscript->GetAI = &GetAI_boss_bloodmage_thalnos; - newscript->RegisterSelf(); + new boss_bloodmage_thalnos(); } - diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp index 50a4dd8f60e..1f35363c635 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp @@ -127,768 +127,778 @@ static const char* Text[]= }; #define EMOTE_LAUGHS "Headless Horseman laughs" - -struct mob_wisp_invisAI : public ScriptedAI +
class mob_wisp_invis : public CreatureScript { - mob_wisp_invisAI(Creature *c) : ScriptedAI(c) - { - Creaturetype = delay = spell = spell2 = 0; - //that's hack but there are no info about range of this spells in dbc - SpellEntry *wisp = GET_SPELL(SPELL_WISP_BLUE); - if (wisp) - wisp->rangeIndex = 6; //100 yards - SpellEntry *port = GET_SPELL(SPELL_WISP_FLIGHT_PORT); - if (port) - port->rangeIndex = 6; - } - - uint32 Creaturetype; - uint32 delay; - uint32 spell; - uint32 spell2; - void Reset(){} - void EnterCombat(Unit * /*who*/){} - void SetType(uint32 _type) - { - switch(Creaturetype = _type) - { - case 1: - spell = SPELL_PUMPKIN_AURA_GREEN; - break; - case 2: - delay = 15000; - spell = SPELL_BODY_FLAME; - spell2 = SPELL_DEATH; - break; - case 3: - delay = 15000; - spell = SPELL_SMOKE; - break; - case 4: - delay = 7000; - spell2 = SPELL_WISP_BLUE; - break; - } - if (spell) - DoCast(me, spell); - } +public: + mob_wisp_invis() : CreatureScript("mob_wisp_invis") { } - void SpellHit(Unit* /*caster*/, const SpellEntry *spell) + CreatureAI* GetAI(Creature* pCreature) const { - if (spell->Id == SPELL_WISP_FLIGHT_PORT && Creaturetype == 4) - me->SetDisplayId(2027); + return new mob_wisp_invisAI (pCreature); } - void MoveInLineOfSight(Unit *who) + struct mob_wisp_invisAI : public ScriptedAI { - if (!who || Creaturetype != 1 || !who->isTargetableForAttack()) - return; - - if (me->IsWithinDist(who, 0.1, false) && !who->HasAura(SPELL_SQUASH_SOUL)) - DoCast(who, SPELL_SQUASH_SOUL); - } + mob_wisp_invisAI(Creature *c) : ScriptedAI(c) + { + Creaturetype = delay = spell = spell2 = 0; + //that's hack but there are no info about range of this spells in dbc + SpellEntry *wisp = GET_SPELL(SPELL_WISP_BLUE); + if (wisp) + wisp->rangeIndex = 6; //100 yards + SpellEntry *port = GET_SPELL(SPELL_WISP_FLIGHT_PORT); + if (port) + port->rangeIndex = 6; + } - void UpdateAI(const uint32 diff) - { - if (delay) + uint32 Creaturetype; + uint32 delay; + uint32 spell; + uint32 spell2; + void Reset(){} + void EnterCombat(Unit * /*who*/){} + void SetType(uint32 _type) { - if (delay <= diff) + switch(Creaturetype = _type) { - me->RemoveAurasDueToSpell(SPELL_SMOKE); - if (spell2) - DoCast(me, spell2); - delay = 0; - } else delay -= diff; + case 1: + spell = SPELL_PUMPKIN_AURA_GREEN; + break; + case 2: + delay = 15000; + spell = SPELL_BODY_FLAME; + spell2 = SPELL_DEATH; + break; + case 3: + delay = 15000; + spell = SPELL_SMOKE; + break; + case 4: + delay = 7000; + spell2 = SPELL_WISP_BLUE; + break; + } + if (spell) + DoCast(me, spell); } - } -}; -struct mob_headAI : public ScriptedAI -{ - mob_headAI(Creature *c) : ScriptedAI(c) {} + void SpellHit(Unit* /*caster*/, const SpellEntry *spell) + { + if (spell->Id == SPELL_WISP_FLIGHT_PORT && Creaturetype == 4) + me->SetDisplayId(2027); + } - uint64 bodyGUID; + void MoveInLineOfSight(Unit *who) + { + if (!who || Creaturetype != 1 || !who->isTargetableForAttack()) + return; - uint32 Phase; - uint32 laugh; - uint32 wait; + if (me->IsWithinDist(who, 0.1, false) && !who->HasAura(SPELL_SQUASH_SOUL)) + DoCast(who, SPELL_SQUASH_SOUL); + } - bool withbody; - bool die; + void UpdateAI(const uint32 diff) + { + if (delay) + { + if (delay <= diff) + { + me->RemoveAurasDueToSpell(SPELL_SMOKE); + if (spell2) + DoCast(me, spell2); + delay = 0; + } else delay -= diff; + } + } + }; - void Reset() - { - Phase = 0; - bodyGUID = 0; - die = false; - withbody = true; - wait = 1000; - laugh = urand(15000,30000); - } +}; +
class mob_head : public CreatureScript +{ +public: + mob_head() : CreatureScript("mob_head") { } - void EnterCombat(Unit * /*who*/) {} - void SaySound(int32 textEntry, Unit *pTarget = 0) + CreatureAI* GetAI(Creature* pCreature) const { - DoScriptText(textEntry, me, pTarget); - //DoCast(me, SPELL_HEAD_SPEAKS, true); - Creature *speaker = DoSpawnCreature(HELPER,0,0,0,0,TEMPSUMMON_TIMED_DESPAWN,1000); - if (speaker) - speaker->CastSpell(speaker,SPELL_HEAD_SPEAKS,false); - laugh += 3000; + return new mob_headAI (pCreature); } - void DamageTaken(Unit* /*done_by*/,uint32 &damage) + struct mob_headAI : public ScriptedAI { - if (withbody) - return; - - switch(Phase) - { - case 1: - if (((me->GetHealth() - damage)*100)/me->GetMaxHealth() < 67) - Disappear(); - break; - case 2: - if (((me->GetHealth() - damage)*100)/me->GetMaxHealth() < 34) - Disappear(); - break; - case 3: - if (damage >= me->GetHealth()) - { - die = true; - withbody = true; - wait = 300; - damage = me->GetHealth() - me->GetMaxHealth()/100; - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->StopMoving(); - //me->GetMotionMaster()->MoveIdle(); - DoCast(me, SPELL_HEAD_IS_DEAD); - } - break; - } - } + mob_headAI(Creature *c) : ScriptedAI(c) {} - void SpellHit(Unit *caster, const SpellEntry* spell) - { - if (!withbody) - return; + uint64 bodyGUID; + + uint32 Phase; + uint32 laugh; + uint32 wait; + + bool withbody; + bool die; - if (spell->Id == SPELL_FLYING_HEAD) + void Reset() { - if (Phase < 3) ++Phase; - else Phase = 3; - withbody = false; - if (!bodyGUID) - bodyGUID = caster->GetGUID(); - me->RemoveAllAuras(); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - DoCast(me, SPELL_HEAD_LANDS, true); - DoCast(me, SPELL_HEAD, false); - SaySound(SAY_LOST_HEAD); - me->GetMotionMaster()->Clear(false); - me->GetMotionMaster()->MoveFleeing(caster->getVictim()); + Phase = 0; + bodyGUID = 0; + die = false; + withbody = true; + wait = 1000; + laugh = urand(15000,30000); } - } - void Disappear();//we must set returned=true(this will prevent from "body calls head" while head flying to body), see function below - void UpdateAI(const uint32 diff) - { - if (!withbody) + + void EnterCombat(Unit * /*who*/) {} + void SaySound(int32 textEntry, Unit *pTarget = 0) { - if (wait <= diff) + DoScriptText(textEntry, me, pTarget); + //DoCast(me, SPELL_HEAD_SPEAKS, true); + Creature *speaker = DoSpawnCreature(HELPER,0,0,0,0,TEMPSUMMON_TIMED_DESPAWN,1000); + if (speaker) + speaker->CastSpell(speaker,SPELL_HEAD_SPEAKS,false); + laugh += 3000; + } + + void DamageTaken(Unit* /*done_by*/,uint32 &damage) + { + if (withbody) + return; + + switch(Phase) { - wait = 1000; - if (!me->getVictim()) return; - me->GetMotionMaster()->Clear(false); - me->GetMotionMaster()->MoveFleeing(me->getVictim()); - } else wait -= diff; + case 1: + if (((me->GetHealth() - damage)*100)/me->GetMaxHealth() < 67) + Disappear(); + break; + case 2: + if (((me->GetHealth() - damage)*100)/me->GetMaxHealth() < 34) + Disappear(); + break; + case 3: + if (damage >= me->GetHealth()) + { + die = true; + withbody = true; + wait = 300; + damage = me->GetHealth() - me->GetMaxHealth()/100; + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->StopMoving(); + //me->GetMotionMaster()->MoveIdle(); + DoCast(me, SPELL_HEAD_IS_DEAD); + } + break; + } + } - if (laugh <= diff) + void SpellHit(Unit *caster, const SpellEntry* spell) + { + if (!withbody) + return; + + if (spell->Id == SPELL_FLYING_HEAD) { - laugh = urand(15000,30000); - DoPlaySoundToSet(me, RandomLaugh[urand(0,2)]); - //DoCast(me, SPELL_HEAD_SPEAKS, true); //this spell remove buff "head" - Creature *speaker = DoSpawnCreature(HELPER,0,0,0,0,TEMPSUMMON_TIMED_DESPAWN,1000); - if (speaker) - speaker->CastSpell(speaker,SPELL_HEAD_SPEAKS,false); - me->MonsterTextEmote(EMOTE_LAUGHS,NULL); - } else laugh -= diff; - } - else - { - if (die) + if (Phase < 3) ++Phase; + else Phase = 3; + withbody = false; + if (!bodyGUID) + bodyGUID = caster->GetGUID(); + me->RemoveAllAuras(); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + DoCast(me, SPELL_HEAD_LANDS, true); + DoCast(me, SPELL_HEAD, false); + SaySound(SAY_LOST_HEAD); + me->GetMotionMaster()->Clear(false); + me->GetMotionMaster()->MoveFleeing(caster->getVictim()); + } + } +
void Disappear(); + void UpdateAI(const uint32 diff) + { + if (!withbody) { if (wait <= diff) { - die = false; - if (Unit *body = Unit::GetUnit((*me), bodyGUID)) - body->Kill(body); - me->Kill(me); + wait = 1000; + if (!me->getVictim()) return; + me->GetMotionMaster()->Clear(false); + me->GetMotionMaster()->MoveFleeing(me->getVictim()); } else wait -= diff; + + if (laugh <= diff) + { + laugh = urand(15000,30000); + DoPlaySoundToSet(me, RandomLaugh[urand(0,2)]); + //DoCast(me, SPELL_HEAD_SPEAKS, true); //this spell remove buff "head" + Creature *speaker = DoSpawnCreature(HELPER,0,0,0,0,TEMPSUMMON_TIMED_DESPAWN,1000); + if (speaker) + speaker->CastSpell(speaker,SPELL_HEAD_SPEAKS,false); + me->MonsterTextEmote(EMOTE_LAUGHS,NULL); + } else laugh -= diff; + } + else + { + if (die) + { + if (wait <= diff) + { + die = false; + if (Unit *body = Unit::GetUnit((*me), bodyGUID)) + body->Kill(body); + me->Kill(me); + } else wait -= diff; + } } } - } -}; + }; -struct boss_headless_horsemanAI : public ScriptedAI +}; +
class boss_headless_horseman : public CreatureScript { - boss_headless_horsemanAI(Creature *c) : ScriptedAI(c) +public: + boss_headless_horseman() : CreatureScript("boss_headless_horseman") { } + + CreatureAI* GetAI(Creature* pCreature) const { - SpellEntry *confl = GET_SPELL(SPELL_CONFLAGRATION); - if (confl) - { - confl->EffectApplyAuraName[0] = SPELL_AURA_PERIODIC_DAMAGE_PERCENT; - confl->EffectBasePoints[0] = 10; - //confl->EffectBaseDice[0] = 10; - confl->DmgMultiplier[0] = 1; - } -/* - if (SpellEntry *confl = GET_SPELL(SPELL_CONFLAGRATION)) - confl->EffectTriggerSpell[1] = 22587; + return new boss_headless_horsemanAI (pCreature); + } - if (SpellEntry *speed = GET_SPELL(22587)) + struct boss_headless_horsemanAI : public ScriptedAI + { + boss_headless_horsemanAI(Creature *c) : ScriptedAI(c) { - speed->Effect[1] = SPELL_EFFECT_APPLY_AURA; - speed->EffectApplyAuraName[1] = SPELL_AURA_MOD_CONFUSE; + SpellEntry *confl = GET_SPELL(SPELL_CONFLAGRATION); + if (confl) + { + confl->EffectApplyAuraName[0] = SPELL_AURA_PERIODIC_DAMAGE_PERCENT; + confl->EffectBasePoints[0] = 10; + //confl->EffectBaseDice[0] = 10; + confl->DmgMultiplier[0] = 1; + } + /* + if (SpellEntry *confl = GET_SPELL(SPELL_CONFLAGRATION)) + confl->EffectTriggerSpell[1] = 22587; + + if (SpellEntry *speed = GET_SPELL(22587)) + { + speed->Effect[1] = SPELL_EFFECT_APPLY_AURA; + speed->EffectApplyAuraName[1] = SPELL_AURA_MOD_CONFUSE; + } + */ + pInstance = c->GetInstanceScript(); } -*/ - pInstance = c->GetInstanceData(); - } - ScriptedInstance *pInstance; + InstanceScript *pInstance; - uint64 headGUID; - uint64 PlayerGUID; + uint64 headGUID; + uint64 PlayerGUID; - uint32 Phase; - uint32 id; - uint32 count; - uint32 say_timer; + uint32 Phase; + uint32 id; + uint32 count; + uint32 say_timer; - uint32 conflagrate; - uint32 summonadds; - uint32 cleave; - uint32 regen; - uint32 whirlwind; - uint32 laugh; - uint32 burn; + uint32 conflagrate; + uint32 summonadds; + uint32 cleave; + uint32 regen; + uint32 whirlwind; + uint32 laugh; + uint32 burn; - bool withhead; - bool returned; - bool IsFlying; - bool wp_reached; - bool burned; + bool withhead; + bool returned; + bool IsFlying; + bool wp_reached; + bool burned; - void Reset() - { - Phase = 1; - conflagrate = 15000; - summonadds = 15000; - laugh = urand(16000,20000); - cleave = 2000; - regen = 1000; - burn = 6000; - count = 0; - say_timer = 3000; - - withhead = true; - returned = true; - burned = false; - IsFlying = false; - DoCast(me, SPELL_HEAD); - if (headGUID) - { - if (Creature* Head = Unit::GetCreature((*me), headGUID)) - Head->DisappearAndDie(); - - headGUID = 0; - } - - //if (pInstance) - // pInstance->SetData(DATA_HORSEMAN_EVENT, NOT_STARTED); - } + void Reset() + { + Phase = 1; + conflagrate = 15000; + summonadds = 15000; + laugh = urand(16000,20000); + cleave = 2000; + regen = 1000; + burn = 6000; + count = 0; + say_timer = 3000; - void FlyMode() - { - me->SetVisibility(VISIBILITY_OFF); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->AddUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT | MOVEMENTFLAG_LEVITATING); - me->SetSpeed(MOVE_WALK,5.0f,true); - wp_reached = false; - count = 0; - say_timer = 3000; - id = 0; - Phase = 0; - } + withhead = true; + returned = true; + burned = false; + IsFlying = false; + DoCast(me, SPELL_HEAD); + if (headGUID) + { + if (Creature* Head = Unit::GetCreature((*me), headGUID)) + Head->DisappearAndDie(); - void MovementInform(uint32 type, uint32 i) - { - if (type != POINT_MOTION_TYPE || !IsFlying || i != id) - return; + headGUID = 0; + } - wp_reached = true; + //if (pInstance) + // pInstance->SetData(DATA_HORSEMAN_EVENT, NOT_STARTED); + } - switch (id) + void FlyMode() { - case 0: - me->SetVisibility(VISIBILITY_ON); - break; - case 1: + me->SetVisibility(VISIBILITY_OFF); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->AddUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT | MOVEMENTFLAG_LEVITATING); + me->SetSpeed(MOVE_WALK,5.0f,true); + wp_reached = false; + count = 0; + say_timer = 3000; + id = 0; + Phase = 0; + } + + void MovementInform(uint32 type, uint32 i) + { + if (type != POINT_MOTION_TYPE || !IsFlying || i != id) + return; + + wp_reached = true; + + switch (id) { - if (Creature *smoke = me->SummonCreature(HELPER,Spawn[1].x,Spawn[1].y,Spawn[1].z,0,TEMPSUMMON_TIMED_DESPAWN,20000)) - CAST_AI(mob_wisp_invisAI, smoke->AI())->SetType(3); - DoCast(me, SPELL_RHYME_BIG); - break; + case 0: + me->SetVisibility(VISIBILITY_ON); + break; + case 1: + { + if (Creature *smoke = me->SummonCreature(HELPER,Spawn[1].x,Spawn[1].y,Spawn[1].z,0,TEMPSUMMON_TIMED_DESPAWN,20000)) + CAST_AI(mob_wisp_invis::mob_wisp_invisAI, smoke->AI())->SetType(3); + DoCast(me, SPELL_RHYME_BIG); + break; + } + case 6: + if (pInstance) + pInstance->SetData(GAMEOBJECT_PUMPKIN_SHRINE, 0); //hide gameobject + break; + case 19: + me->RemoveUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT | MOVEMENTFLAG_LEVITATING); + break; + case 20: + { + Phase = 1; + IsFlying = false; + wp_reached = false; + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + SaySound(SAY_ENTRANCE); + if (Unit *plr = Unit::GetUnit((*me),PlayerGUID)) + DoStartMovement(plr); + break; + } } - case 6: - if (pInstance) - pInstance->SetData(GAMEOBJECT_PUMPKIN_SHRINE, 0); //hide gameobject - break; - case 19: - me->RemoveUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT | MOVEMENTFLAG_LEVITATING); - break; - case 20: + ++id; + } + + void EnterCombat(Unit * /*who*/) + { + if (pInstance) + pInstance->SetData(DATA_HORSEMAN_EVENT, IN_PROGRESS); + DoZoneInCombat(); + } + void AttackStart(Unit* who) {ScriptedAI::AttackStart(who);} + void MoveInLineOfSight(Unit *who) + { + if (withhead && Phase != 0) + ScriptedAI::MoveInLineOfSight(who); + } + void KilledUnit(Unit *plr) + { + if (plr->GetTypeId() == TYPEID_PLAYER) { - Phase = 1; - IsFlying = false; - wp_reached = false; - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - SaySound(SAY_ENTRANCE); - if (Unit *plr = Unit::GetUnit((*me),PlayerGUID)) - DoStartMovement(plr); - break; + if (withhead) + SaySound(SAY_PLAYER_DEATH); + //maybe possible when player dies from conflagration + else if (Creature *Head = Unit::GetCreature((*me), headGUID)) + CAST_AI(mob_head::mob_headAI, Head->AI())->SaySound(SAY_PLAYER_DEATH); } } - ++id; - } - void EnterCombat(Unit * /*who*/) - { - if (pInstance) - pInstance->SetData(DATA_HORSEMAN_EVENT, IN_PROGRESS); - DoZoneInCombat(); - } - void AttackStart(Unit* who) {ScriptedAI::AttackStart(who);} - void MoveInLineOfSight(Unit *who) - { - if (withhead && Phase != 0) - ScriptedAI::MoveInLineOfSight(who); - } - void KilledUnit(Unit *plr) - { - if (plr->GetTypeId() == TYPEID_PLAYER) + void SaySound(int32 textEntry, Unit *pTarget = 0) { - if (withhead) - SaySound(SAY_PLAYER_DEATH); - //maybe possible when player dies from conflagration - else if (Creature *Head = Unit::GetCreature((*me), headGUID)) - CAST_AI(mob_headAI, Head->AI())->SaySound(SAY_PLAYER_DEATH); + DoScriptText(textEntry, me, pTarget); + laugh += 4000; } - } - void SaySound(int32 textEntry, Unit *pTarget = 0) - { - DoScriptText(textEntry, me, pTarget); - laugh += 4000; - } + Player* SelectRandomPlayer(float range = 0.0f, bool checkLoS = true) + { + Map* pMap = me->GetMap(); + if (!pMap->IsDungeon()) return NULL; - Player* SelectRandomPlayer(float range = 0.0f, bool checkLoS = true) - { - Map* pMap = me->GetMap(); - if (!pMap->IsDungeon()) return NULL; + Map::PlayerList const &PlayerList = pMap->GetPlayers(); + Map::PlayerList::const_iterator i; + if (PlayerList.isEmpty()) return NULL; - Map::PlayerList const &PlayerList = pMap->GetPlayers(); - Map::PlayerList::const_iterator i; - if (PlayerList.isEmpty()) return NULL; + std::list<Player*> temp; + std::list<Player*>::const_iterator j; - std::list<Player*> temp; - std::list<Player*>::const_iterator j; + for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) + if ((me->IsWithinLOSInMap(i->getSource()) || !checkLoS) && me->getVictim() != i->getSource() && + me->IsWithinDistInMap(i->getSource(), range) && i->getSource()->isAlive()) + temp.push_back(i->getSource()); - for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) - if ((me->IsWithinLOSInMap(i->getSource()) || !checkLoS) && me->getVictim() != i->getSource() && - me->IsWithinDistInMap(i->getSource(), range) && i->getSource()->isAlive()) - temp.push_back(i->getSource()); + if (temp.size()) + { + j = temp.begin(); + advance(j, rand()%temp.size()); + return (*j); + } + return NULL; + } - if (temp.size()) + void SpellHitTarget(Unit* unit, const SpellEntry* spell) { - j = temp.begin(); - advance(j, rand()%temp.size()); - return (*j); + if (spell->Id == SPELL_CONFLAGRATION && unit->HasAura(SPELL_CONFLAGRATION)) + SaySound(SAY_CONFLAGRATION,unit); } - return NULL; - } - void SpellHitTarget(Unit* unit, const SpellEntry* spell) - { - if (spell->Id == SPELL_CONFLAGRATION && unit->HasAura(SPELL_CONFLAGRATION)) - SaySound(SAY_CONFLAGRATION,unit); - } - - void JustDied(Unit* /*killer*/) - { - me->StopMoving(); - //me->GetMotionMaster()->MoveIdle(); - SaySound(SAY_DEATH); - if (Creature *flame = DoSpawnCreature(HELPER,0,0,0,0,TEMPSUMMON_TIMED_DESPAWN,60000)) - flame->CastSpell(flame,SPELL_BODY_FLAME,false); - if (Creature *wisp = DoSpawnCreature(WISP_INVIS,0,0,0,0,TEMPSUMMON_TIMED_DESPAWN,60000)) - CAST_AI(mob_wisp_invisAI, wisp->AI())->SetType(4); - if (pInstance) - pInstance->SetData(DATA_HORSEMAN_EVENT, DONE); - } - - void SpellHit(Unit *caster, const SpellEntry* spell) - { - if (withhead) - return; + void JustDied(Unit* /*killer*/) + { + me->StopMoving(); + //me->GetMotionMaster()->MoveIdle(); + SaySound(SAY_DEATH); + if (Creature *flame = DoSpawnCreature(HELPER,0,0,0,0,TEMPSUMMON_TIMED_DESPAWN,60000)) + flame->CastSpell(flame,SPELL_BODY_FLAME,false); + if (Creature *wisp = DoSpawnCreature(WISP_INVIS,0,0,0,0,TEMPSUMMON_TIMED_DESPAWN,60000)) + CAST_AI(mob_wisp_invis::mob_wisp_invisAI, wisp->AI())->SetType(4); + if (pInstance) + pInstance->SetData(DATA_HORSEMAN_EVENT, DONE); + } - if (spell->Id == SPELL_FLYING_HEAD) + void SpellHit(Unit *caster, const SpellEntry* spell) { - if (Phase < 3) - ++Phase; - else - Phase = 3; - withhead = true; - me->RemoveAllAuras(); - me->SetName("Headless Horseman"); - me->SetHealth(me->GetMaxHealth()); - SaySound(SAY_REJOINED); - DoCast(me, SPELL_HEAD); - caster->GetMotionMaster()->Clear(false); - caster->GetMotionMaster()->MoveFollow(me,6,urand(0,5)); - //DoResetThreat();//not sure if need - std::list<HostileReference*>::const_iterator itr; - for (itr = caster->getThreatManager().getThreatList().begin(); itr != caster->getThreatManager().getThreatList().end(); ++itr) + if (withhead) + return; + + if (spell->Id == SPELL_FLYING_HEAD) { - Unit* pUnit = Unit::GetUnit((*me), (*itr)->getUnitGuid()); - if (pUnit && pUnit->isAlive() && pUnit != caster) - me->AddThreat(pUnit,caster->getThreatManager().getThreat(pUnit)); + if (Phase < 3) + ++Phase; + else + Phase = 3; + withhead = true; + me->RemoveAllAuras(); + me->SetName("Headless Horseman"); + me->SetHealth(me->GetMaxHealth()); + SaySound(SAY_REJOINED); + DoCast(me, SPELL_HEAD); + caster->GetMotionMaster()->Clear(false); + caster->GetMotionMaster()->MoveFollow(me,6,urand(0,5)); + //DoResetThreat();//not sure if need + std::list<HostileReference*>::const_iterator itr; + for (itr = caster->getThreatManager().getThreatList().begin(); itr != caster->getThreatManager().getThreatList().end(); ++itr) + { + Unit* pUnit = Unit::GetUnit((*me), (*itr)->getUnitGuid()); + if (pUnit && pUnit->isAlive() && pUnit != caster) + me->AddThreat(pUnit,caster->getThreatManager().getThreat(pUnit)); + } } } - } - void DamageTaken(Unit *done_by, uint32 &damage) - { - if (damage >= me->GetHealth() && withhead) + void DamageTaken(Unit *done_by, uint32 &damage) { - withhead = false; - returned = false; - damage = me->GetHealth() - me->GetMaxHealth()/100; - me->RemoveAllAuras(); - me->SetName("Headless Horseman, Unhorsed"); - - if (!headGUID) - headGUID = DoSpawnCreature(HEAD,rand()%6,rand()%6,0,0,TEMPSUMMON_DEAD_DESPAWN,0)->GetGUID(); - Unit* Head = Unit::GetUnit((*me), headGUID); - if (Head && Head->isAlive()) + if (damage >= me->GetHealth() && withhead) { - Head->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - //Head->CastSpell(Head,SPELL_HEAD_INVIS,false); - me->InterruptNonMeleeSpells(false); - DoCast(me, SPELL_IMMUNE, true); - DoCast(me, SPELL_BODY_REGEN, true); - DoCast(Head, SPELL_FLYING_HEAD, true); - DoCast(me, SPELL_CONFUSE, false); //test - done_by->ProcDamageAndSpell(me,PROC_FLAG_KILL,PROC_FLAG_KILLED,PROC_EX_NONE,0); - whirlwind = urand(4000,8000); - regen = 0; + withhead = false; + returned = false; + damage = me->GetHealth() - me->GetMaxHealth()/100; + me->RemoveAllAuras(); + me->SetName("Headless Horseman, Unhorsed"); + + if (!headGUID) + headGUID = DoSpawnCreature(HEAD,rand()%6,rand()%6,0,0,TEMPSUMMON_DEAD_DESPAWN,0)->GetGUID(); + Unit* Head = Unit::GetUnit((*me), headGUID); + if (Head && Head->isAlive()) + { + Head->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + //Head->CastSpell(Head,SPELL_HEAD_INVIS,false); + me->InterruptNonMeleeSpells(false); + DoCast(me, SPELL_IMMUNE, true); + DoCast(me, SPELL_BODY_REGEN, true); + DoCast(Head, SPELL_FLYING_HEAD, true); + DoCast(me, SPELL_CONFUSE, false); //test + done_by->ProcDamageAndSpell(me,PROC_FLAG_KILL,PROC_FLAG_KILLED,PROC_EX_NONE,0); + whirlwind = urand(4000,8000); + regen = 0; + } } } - } - void UpdateAI(const uint32 diff) - { - if (withhead) + void UpdateAI(const uint32 diff) { - switch(Phase) + if (withhead) { - case 0: + switch(Phase) { - if (!IsFlying) + case 0: { - if (say_timer <= diff) + if (!IsFlying) { - say_timer = 3000; - Player *plr = SelectRandomPlayer(100.0f,false); - if (count < 3) - { - if (plr) - plr->Say(Text[count],0); - } - else + if (say_timer <= diff) { - DoCast(me, SPELL_RHYME_BIG); - if (plr) + say_timer = 3000; + Player *plr = SelectRandomPlayer(100.0f,false); + if (count < 3) { - plr->Say(Text[count],0); - plr->HandleEmoteCommand(ANIM_EMOTE_SHOUT); + if (plr) + plr->Say(Text[count],0); } - wp_reached = true; - IsFlying = true; - count = 0; - break; - } - ++count; - } else say_timer -= diff; - } - else - { - if (wp_reached) + else + { + DoCast(me, SPELL_RHYME_BIG); + if (plr) + { + plr->Say(Text[count],0); + plr->HandleEmoteCommand(ANIM_EMOTE_SHOUT); + } + wp_reached = true; + IsFlying = true; + count = 0; + break; + } + ++count; + } else say_timer -= diff; + } + else { - wp_reached = false; - me->GetMotionMaster()->Clear(false); - me->GetMotionMaster()->MovePoint(id,FlightPoint[id].x,FlightPoint[id].y,FlightPoint[id].z); + if (wp_reached) + { + wp_reached = false; + me->GetMotionMaster()->Clear(false); + me->GetMotionMaster()->MovePoint(id,FlightPoint[id].x,FlightPoint[id].y,FlightPoint[id].z); + } } } - } - break; - case 1: - if (burned) - break; - if (burn <= diff) - { - if (Creature *flame = me->SummonCreature(HELPER,Spawn[0].x,Spawn[0].y,Spawn[0].z,0,TEMPSUMMON_TIMED_DESPAWN,17000)) - CAST_AI(mob_wisp_invisAI, flame->AI())->SetType(2); - burned = true; - } else burn -= diff; - break; - case 2: - if (conflagrate <= diff) - { - if (Unit *plr = SelectRandomPlayer(30.0f)) - DoCast(plr, SPELL_CONFLAGRATION, false); - conflagrate = urand(10000,16000); - } else conflagrate -= diff; break; - case 3: - if (summonadds <= diff) - { - me->InterruptNonMeleeSpells(false); - DoCast(me, SPELL_SUMMON_PUMPKIN); - SaySound(SAY_SPROUTING_PUMPKINS); - summonadds = urand(25000,35000); - } else summonadds -= diff; - break; - } + case 1: + if (burned) + break; + if (burn <= diff) + { + if (Creature *flame = me->SummonCreature(HELPER,Spawn[0].x,Spawn[0].y,Spawn[0].z,0,TEMPSUMMON_TIMED_DESPAWN,17000)) + CAST_AI(mob_wisp_invis::mob_wisp_invisAI, flame->AI())->SetType(2); + burned = true; + } else burn -= diff; + break; + case 2: + if (conflagrate <= diff) + { + if (Unit *plr = SelectRandomPlayer(30.0f)) + DoCast(plr, SPELL_CONFLAGRATION, false); + conflagrate = urand(10000,16000); + } else conflagrate -= diff; + break; + case 3: + if (summonadds <= diff) + { + me->InterruptNonMeleeSpells(false); + DoCast(me, SPELL_SUMMON_PUMPKIN); + SaySound(SAY_SPROUTING_PUMPKINS); + summonadds = urand(25000,35000); + } else summonadds -= diff; + break; + } - if (laugh <= diff) - { - laugh = urand(11000,22000); - me->MonsterTextEmote(EMOTE_LAUGHS,NULL); - DoPlaySoundToSet(me, RandomLaugh[rand()%3]); - } else laugh -= diff; + if (laugh <= diff) + { + laugh = urand(11000,22000); + me->MonsterTextEmote(EMOTE_LAUGHS,NULL); + DoPlaySoundToSet(me, RandomLaugh[rand()%3]); + } else laugh -= diff; - if (UpdateVictim()) - { - DoMeleeAttackIfReady(); - if (cleave <= diff) + if (UpdateVictim()) { - DoCast(me->getVictim(), SPELL_CLEAVE); - cleave = urand(2000,6000); //1 cleave per 2.0-6.0sec - } else cleave -= diff; + DoMeleeAttackIfReady(); + if (cleave <= diff) + { + DoCast(me->getVictim(), SPELL_CLEAVE); + cleave = urand(2000,6000); //1 cleave per 2.0-6.0sec + } else cleave -= diff; + } } - } - else - { - if (regen <= diff) + else { - regen = 1000; //"body calls head" - if (me->GetHealth()/me->GetMaxHealth() == 1 && !returned) + if (regen <= diff) { - if (Phase > 1) - --Phase; - else - Phase = 1; - Creature* Head = Unit::GetCreature((*me), headGUID); - if (Head && Head->isAlive()) + regen = 1000; //"body calls head" + if (me->GetHealth()/me->GetMaxHealth() == 1 && !returned) { - CAST_AI(mob_headAI, Head->AI())->Phase = Phase; - CAST_AI(mob_headAI, Head->AI())->Disappear(); + if (Phase > 1) + --Phase; + else + Phase = 1; + Creature* Head = Unit::GetCreature((*me), headGUID); + if (Head && Head->isAlive()) + { + CAST_AI(mob_head::mob_headAI, Head->AI())->Phase = Phase; + CAST_AI(mob_head::mob_headAI, Head->AI())->Disappear(); + } + return; } - return; } - } - else regen -= diff; + else regen -= diff; - if (whirlwind <= diff) - { - whirlwind = urand(4000,8000); - if (urand(0,1)) + if (whirlwind <= diff) { - me->RemoveAurasDueToSpell(SPELL_CONFUSE); - DoCast(me, SPELL_WHIRLWIND, true); - DoCast(me, SPELL_CONFUSE); - } else - me->RemoveAurasDueToSpell(SPELL_WHIRLWIND); - } else whirlwind -= diff; + whirlwind = urand(4000,8000); + if (urand(0,1)) + { + me->RemoveAurasDueToSpell(SPELL_CONFUSE); + DoCast(me, SPELL_WHIRLWIND, true); + DoCast(me, SPELL_CONFUSE); + } else + me->RemoveAurasDueToSpell(SPELL_WHIRLWIND); + } else whirlwind -= diff; + } } - } + }; + }; -void mob_headAI::Disappear() -{ - if (withbody) - return; - if (bodyGUID) - { - Creature *body = Unit::GetCreature((*me), bodyGUID); - if (body && body->isAlive()) - { - withbody = true; - me->RemoveAllAuras(); - body->RemoveAurasDueToSpell(SPELL_IMMUNE);//hack, SpellHit doesn't calls if body has immune aura - DoCast(body, SPELL_FLYING_HEAD); - me->SetHealth(me->GetMaxHealth()); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->GetMotionMaster()->MoveIdle(); - CAST_AI(boss_headless_horsemanAI, body->AI())->returned = true; - } - } -} -struct mob_pulsing_pumpkinAI : public ScriptedAI +
class mob_pulsing_pumpkin : public CreatureScript { - mob_pulsing_pumpkinAI(Creature *c) : ScriptedAI(c) {} +public: + mob_pulsing_pumpkin() : CreatureScript("mob_pulsing_pumpkin") { } - bool sprouted; - uint64 debuffGUID; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - float x, y, z; - me->GetPosition(x, y, z); //this visual aura some under ground - me->GetMap()->CreatureRelocation(me, x,y,z + 0.35f, 0.0f); - Despawn(); - Creature *debuff = DoSpawnCreature(HELPER,0,0,0,0,TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN,14500); - if (debuff) - { - debuff->SetDisplayId(me->GetDisplayId()); - debuff->CastSpell(debuff,SPELL_PUMPKIN_AURA_GREEN,false); - CAST_AI(mob_wisp_invisAI, debuff->AI())->SetType(1); - debuffGUID = debuff->GetGUID(); - } - sprouted = false; - DoCast(me, SPELL_PUMPKIN_AURA, true); - DoCast(me, SPELL_SPROUTING); - me->SetFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_STUNNED); + return new mob_pulsing_pumpkinAI (pCreature); } - void EnterCombat(Unit * /*who*/){} - - void SpellHit(Unit * /*caster*/, const SpellEntry *spell) + struct mob_pulsing_pumpkinAI : public ScriptedAI { - if (spell->Id == SPELL_SPROUTING) + mob_pulsing_pumpkinAI(Creature *c) : ScriptedAI(c) {} + + bool sprouted; + uint64 debuffGUID; + + void Reset() { - sprouted = true; - me->RemoveAllAuras(); - me->RemoveFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_STUNNED); - DoCast(me, SPELL_SPROUT_BODY, true); - me->UpdateEntry(PUMPKIN_FIEND); - DoStartMovement(me->getVictim()); + float x, y, z; + me->GetPosition(x, y, z); //this visual aura some under ground + me->GetMap()->CreatureRelocation(me, x,y,z + 0.35f, 0.0f); + Despawn(); + Creature *debuff = DoSpawnCreature(HELPER,0,0,0,0,TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN,14500); + if (debuff) + { + debuff->SetDisplayId(me->GetDisplayId()); + debuff->CastSpell(debuff,SPELL_PUMPKIN_AURA_GREEN,false); + CAST_AI(mob_wisp_invis::mob_wisp_invisAI, debuff->AI())->SetType(1); + debuffGUID = debuff->GetGUID(); + } + sprouted = false; + DoCast(me, SPELL_PUMPKIN_AURA, true); + DoCast(me, SPELL_SPROUTING); + me->SetFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_STUNNED); } - } - void Despawn() - { - if (!debuffGUID) return; - Unit *debuff = Unit::GetUnit((*me),debuffGUID); - if (debuff) - debuff->SetVisibility(VISIBILITY_OFF); - debuffGUID = 0; - } + void EnterCombat(Unit * /*who*/){} - void JustDied(Unit * /*killer*/) { if (!sprouted) Despawn(); } + void SpellHit(Unit * /*caster*/, const SpellEntry *spell) + { + if (spell->Id == SPELL_SPROUTING) + { + sprouted = true; + me->RemoveAllAuras(); + me->RemoveFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_STUNNED); + DoCast(me, SPELL_SPROUT_BODY, true); + me->UpdateEntry(PUMPKIN_FIEND); + DoStartMovement(me->getVictim()); + } + } - void MoveInLineOfSight(Unit *who) - { - if (!who || !who->isTargetableForAttack() || !me->IsHostileTo(who) || me->getVictim()) - return; + void Despawn() + { + if (!debuffGUID) return; + Unit *debuff = Unit::GetUnit((*me),debuffGUID); + if (debuff) + debuff->SetVisibility(VISIBILITY_OFF); + debuffGUID = 0; + } - me->AddThreat(who,0.0f); - if (sprouted) - DoStartMovement(who); - } + void JustDied(Unit * /*killer*/) { if (!sprouted) Despawn(); } - void UpdateAI(const uint32 /*diff*/) - { - if (sprouted && UpdateVictim()) - DoMeleeAttackIfReady(); - } -}; + void MoveInLineOfSight(Unit *who) + { + if (!who || !who->isTargetableForAttack() || !me->IsHostileTo(who) || me->getVictim()) + return; -bool GOHello_go_loosely_turned_soil(Player* pPlayer, GameObject* soil) -{ - ScriptedInstance* pInstance = pPlayer->GetInstanceData(); - if (pInstance) - { - if (pInstance->GetData(DATA_HORSEMAN_EVENT) != NOT_STARTED) - return true; - pInstance->SetData(DATA_HORSEMAN_EVENT, IN_PROGRESS); - } -/* if (soil->GetGoType() == GAMEOBJECT_TYPE_QUESTGIVER && plr->getLevel() > 64) - { - plr->PrepareQuestMenu(soil->GetGUID()); - plr->SendPreparedQuest(soil->GetGUID()); - } - if (plr->GetQuestStatus(11405) == QUEST_STATUS_INCOMPLETE && plr->getLevel() > 64) - { */ - pPlayer->AreaExploredOrEventHappens(11405); - if (Creature *horseman = soil->SummonCreature(HH_MOUNTED,FlightPoint[20].x,FlightPoint[20].y,FlightPoint[20].z,0,TEMPSUMMON_MANUAL_DESPAWN,0)) + me->AddThreat(who,0.0f); + if (sprouted) + DoStartMovement(who); + } + + void UpdateAI(const uint32 /*diff*/) { - CAST_AI(boss_headless_horsemanAI, horseman->AI())->PlayerGUID = pPlayer->GetGUID(); - CAST_AI(boss_headless_horsemanAI, horseman->AI())->FlyMode(); + if (sprouted && UpdateVictim()) + DoMeleeAttackIfReady(); } - //} - return true; -} + }; -CreatureAI* GetAI_mob_head(Creature* pCreature) +}; +
class go_loosely_turned_soil : public GameObjectScript { - return new mob_headAI (pCreature); -} +public: + go_loosely_turned_soil() : GameObjectScript("go_loosely_turned_soil") { } -CreatureAI* GetAI_boss_headless_horseman(Creature* pCreature) -{ - return new boss_headless_horsemanAI (pCreature); -} + bool OnGossipHello(Player* pPlayer, GameObject* soil) + { + InstanceScript* pInstance = pPlayer->GetInstanceScript(); + if (pInstance) + { + if (pInstance->GetData(DATA_HORSEMAN_EVENT) != NOT_STARTED) + return true; + pInstance->SetData(DATA_HORSEMAN_EVENT, IN_PROGRESS); + } + /* if (soil->GetGoType() == GAMEOBJECT_TYPE_QUESTGIVER && plr->getLevel() > 64) + { + plr->PrepareQuestMenu(soil->GetGUID()); + plr->SendPreparedQuest(soil->GetGUID()); + } + if (plr->GetQuestStatus(11405) == QUEST_STATUS_INCOMPLETE && plr->getLevel() > 64) + { */ + pPlayer->AreaExploredOrEventHappens(11405); + if (Creature *horseman = soil->SummonCreature(HH_MOUNTED,FlightPoint[20].x,FlightPoint[20].y,FlightPoint[20].z,0,TEMPSUMMON_MANUAL_DESPAWN,0)) + { + CAST_AI(boss_headless_horseman::boss_headless_horsemanAI, horseman->AI())->PlayerGUID = pPlayer->GetGUID(); + CAST_AI(boss_headless_horseman::boss_headless_horsemanAI, horseman->AI())->FlyMode(); + } + //} + return true; + } -CreatureAI* GetAI_mob_pulsing_pumpkin(Creature* pCreature) -{ - return new mob_pulsing_pumpkinAI (pCreature); -} +}; -CreatureAI* GetAI_mob_wisp_invis(Creature* pCreature) +void mob_head::mob_headAI::Disappear() { - return new mob_wisp_invisAI (pCreature); + if (withbody) + return; + if (bodyGUID) + { + Creature *body = Unit::GetCreature((*me), bodyGUID); + if (body && body->isAlive()) + { + withbody = true; + me->RemoveAllAuras(); + body->RemoveAurasDueToSpell(SPELL_IMMUNE);//hack, SpellHit doesn't calls if body has immune aura + DoCast(body, SPELL_FLYING_HEAD); + me->SetHealth(me->GetMaxHealth()); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->GetMotionMaster()->MoveIdle(); + CAST_AI(boss_headless_horseman::boss_headless_horsemanAI, body->AI())->returned = true; + } + } } void AddSC_boss_headless_horseman() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_headless_horseman"; - newscript->GetAI = &GetAI_boss_headless_horseman; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_head"; - newscript->GetAI = &GetAI_mob_head; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_pulsing_pumpkin"; - newscript->GetAI = &GetAI_mob_pulsing_pumpkin; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_wisp_invis"; - newscript->GetAI = &GetAI_mob_wisp_invis; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "go_loosely_turned_soil"; - newscript->pGOHello = &GOHello_go_loosely_turned_soil; - newscript->RegisterSelf(); + new boss_headless_horseman(); + new mob_head(); + new mob_pulsing_pumpkin(); + new mob_wisp_invis(); + new go_loosely_turned_soil(); } - diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_herod.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_herod.cpp index e6b535c1073..4200b4689bd 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_herod.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_herod.cpp @@ -39,122 +39,127 @@ EndScriptData */ #define ENTRY_SCARLET_TRAINEE 6575 #define ENTRY_SCARLET_MYRMIDON 4295 - -struct boss_herodAI : public ScriptedAI +
class boss_herod : public CreatureScript { - boss_herodAI(Creature *c) : ScriptedAI(c) {} - - bool Enrage; +public: + boss_herod() : CreatureScript("boss_herod") { } - uint32 Cleave_Timer; - uint32 Whirlwind_Timer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - Enrage = false; - Cleave_Timer = 12000; - Whirlwind_Timer = 60000; + return new boss_herodAI(pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_herodAI : public ScriptedAI { - DoScriptText(SAY_AGGRO, me); - DoCast(me, SPELL_RUSHINGCHARGE); - } + boss_herodAI(Creature *c) : ScriptedAI(c) {} - void KilledUnit(Unit * /*victim*/) - { - DoScriptText(SAY_KILL, me); - } + bool Enrage; - void JustDied(Unit* /*killer*/) - { - for (uint8 i = 0; i < 20; ++i) - me->SummonCreature(ENTRY_SCARLET_TRAINEE, 1939.18, -431.58, 17.09, 6.22, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 600000); - } + uint32 Cleave_Timer; + uint32 Whirlwind_Timer; - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - //If we are <30% hp goes Enraged - if (!Enrage && me->GetHealth()*100 / me->GetMaxHealth() <= 30 && !me->IsNonMeleeSpellCasted(false)) + void Reset() { - DoScriptText(EMOTE_ENRAGE, me); - DoScriptText(SAY_ENRAGE, me); - DoCast(me, SPELL_FRENZY); - Enrage = true; + Enrage = false; + Cleave_Timer = 12000; + Whirlwind_Timer = 60000; } - //Cleave_Timer - if (Cleave_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - DoCast(me->getVictim(), SPELL_CLEAVE); - Cleave_Timer = 12000; - } else Cleave_Timer -= diff; + DoScriptText(SAY_AGGRO, me); + DoCast(me, SPELL_RUSHINGCHARGE); + } + + void KilledUnit(Unit * /*victim*/) + { + DoScriptText(SAY_KILL, me); + } - // Whirlwind_Timer - if (Whirlwind_Timer <= diff) + void JustDied(Unit* /*killer*/) + { + for (uint8 i = 0; i < 20; ++i) + me->SummonCreature(ENTRY_SCARLET_TRAINEE, 1939.18, -431.58, 17.09, 6.22, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 600000); + } + + void UpdateAI(const uint32 diff) { - DoScriptText(SAY_WHIRLWIND, me); - DoCast(me->getVictim(), SPELL_WHIRLWIND); - Whirlwind_Timer = 30000; - } else Whirlwind_Timer -= diff; + if (!UpdateVictim()) + return; + + //If we are <30% hp goes Enraged + if (!Enrage && me->GetHealth()*100 / me->GetMaxHealth() <= 30 && !me->IsNonMeleeSpellCasted(false)) + { + DoScriptText(EMOTE_ENRAGE, me); + DoScriptText(SAY_ENRAGE, me); + DoCast(me, SPELL_FRENZY); + Enrage = true; + } + + //Cleave_Timer + if (Cleave_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_CLEAVE); + Cleave_Timer = 12000; + } else Cleave_Timer -= diff; + + // Whirlwind_Timer + if (Whirlwind_Timer <= diff) + { + DoScriptText(SAY_WHIRLWIND, me); + DoCast(me->getVictim(), SPELL_WHIRLWIND); + Whirlwind_Timer = 30000; + } else Whirlwind_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_herod(Creature* pCreature) +
class mob_scarlet_trainee : public CreatureScript { - return new boss_herodAI(pCreature); -} +public: + mob_scarlet_trainee() : CreatureScript("mob_scarlet_trainee") { } -struct mob_scarlet_traineeAI : public npc_escortAI -{ - mob_scarlet_traineeAI(Creature *c) : npc_escortAI(c) + CreatureAI* GetAI(Creature* pCreature) const { - Start_Timer = urand(1000,6000); + return new mob_scarlet_traineeAI(pCreature); } - uint32 Start_Timer; + struct mob_scarlet_traineeAI : public npc_escortAI + { + mob_scarlet_traineeAI(Creature *c) : npc_escortAI(c) + { + Start_Timer = urand(1000,6000); + } - void Reset() {} - void WaypointReached(uint32 /*uiPoint*/) {} - void EnterCombat(Unit* /*who*/) {} + uint32 Start_Timer; - void UpdateAI(const uint32 diff) - { - if (Start_Timer) + void Reset() {} + void WaypointReached(uint32 /*uiPoint*/) {} + void EnterCombat(Unit* /*who*/) {} + + void UpdateAI(const uint32 diff) { - if (Start_Timer <= diff) + if (Start_Timer) { - Start(true,true); - Start_Timer = 0; - } else Start_Timer -= diff; + if (Start_Timer <= diff) + { + Start(true,true); + Start_Timer = 0; + } else Start_Timer -= diff; + } + + npc_escortAI::UpdateAI(diff); } + }; - npc_escortAI::UpdateAI(diff); - } }; -CreatureAI* GetAI_mob_scarlet_trainee(Creature* pCreature) -{ - return new mob_scarlet_traineeAI(pCreature); -} void AddSC_boss_herod() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_herod"; - newscript->GetAI = &GetAI_boss_herod; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_scarlet_trainee"; - newscript->GetAI = &GetAI_mob_scarlet_trainee; - newscript->RegisterSelf(); + new boss_herod(); + new mob_scarlet_trainee(); } - diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_high_inquisitor_fairbanks.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_high_inquisitor_fairbanks.cpp index e643e001ca6..9c595c522c6 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_high_inquisitor_fairbanks.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_high_inquisitor_fairbanks.cpp @@ -34,102 +34,104 @@ enum eSpells SPELL_POWERWORDSHIELD = 11647, SPELL_SLEEP = 8399 }; - -struct boss_high_inquisitor_fairbanksAI : public ScriptedAI +
class boss_high_inquisitor_fairbanks : public CreatureScript { - boss_high_inquisitor_fairbanksAI(Creature *c) : ScriptedAI(c) {} - - uint32 CurseOfBlood_Timer; - uint32 DispelMagic_Timer; - uint32 Fear_Timer; - uint32 Heal_Timer; - uint32 Sleep_Timer; - uint32 Dispel_Timer; - bool PowerWordShield; - - void Reset() - { - CurseOfBlood_Timer = 10000; - DispelMagic_Timer = 30000; - Fear_Timer = 40000; - Heal_Timer = 30000; - Sleep_Timer = 30000; - Dispel_Timer = 20000; - PowerWordShield = false; - } +public: + boss_high_inquisitor_fairbanks() : CreatureScript("boss_high_inquisitor_fairbanks") { } - void EnterCombat(Unit * /*who*/) + CreatureAI* GetAI(Creature* pCreature) const { + return new boss_high_inquisitor_fairbanksAI (pCreature); } - void UpdateAI(const uint32 diff) + struct boss_high_inquisitor_fairbanksAI : public ScriptedAI { - if (!UpdateVictim()) - return; + boss_high_inquisitor_fairbanksAI(Creature *c) : ScriptedAI(c) {} - //If we are <25% hp cast Heal - if (me->GetHealth()*100 / me->GetMaxHealth() <= 25 && !me->IsNonMeleeSpellCasted(false) && Heal_Timer <= diff) - { - DoCast(me, SPELL_HEAL); - Heal_Timer = 30000; - } else Heal_Timer -= diff; + uint32 CurseOfBlood_Timer; + uint32 DispelMagic_Timer; + uint32 Fear_Timer; + uint32 Heal_Timer; + uint32 Sleep_Timer; + uint32 Dispel_Timer; + bool PowerWordShield; - //Fear_Timer - if (Fear_Timer <= diff) + void Reset() { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,1)) - DoCast(pTarget, SPELL_FEAR); - + CurseOfBlood_Timer = 10000; + DispelMagic_Timer = 30000; Fear_Timer = 40000; - } else Fear_Timer -= diff; - - //Sleep_Timer - if (Sleep_Timer <= diff) - { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_TOPAGGRO,0)) - DoCast(pTarget, SPELL_SLEEP); - + Heal_Timer = 30000; Sleep_Timer = 30000; - } else Sleep_Timer -= diff; - - //PowerWordShield_Timer - if (!PowerWordShield && me->GetHealth()*100 / me->GetMaxHealth() <= 25) - { - DoCast(me, SPELL_POWERWORDSHIELD); - PowerWordShield = true; + Dispel_Timer = 20000; + PowerWordShield = false; } - //Dispel_Timer - if (Dispel_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) - DoCast(pTarget, SPELL_DISPELMAGIC); - - DispelMagic_Timer = 30000; - } else DispelMagic_Timer -= diff; + } - //CurseOfBlood_Timer - if (CurseOfBlood_Timer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_CURSEOFBLOOD); - CurseOfBlood_Timer = 25000; - } else CurseOfBlood_Timer -= diff; + if (!UpdateVictim()) + return; + + //If we are <25% hp cast Heal + if (me->GetHealth()*100 / me->GetMaxHealth() <= 25 && !me->IsNonMeleeSpellCasted(false) && Heal_Timer <= diff) + { + DoCast(me, SPELL_HEAL); + Heal_Timer = 30000; + } else Heal_Timer -= diff; + + //Fear_Timer + if (Fear_Timer <= diff) + { + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,1)) + DoCast(pTarget, SPELL_FEAR); + + Fear_Timer = 40000; + } else Fear_Timer -= diff; + + //Sleep_Timer + if (Sleep_Timer <= diff) + { + if (Unit *pTarget = SelectUnit(SELECT_TARGET_TOPAGGRO,0)) + DoCast(pTarget, SPELL_SLEEP); + + Sleep_Timer = 30000; + } else Sleep_Timer -= diff; + + //PowerWordShield_Timer + if (!PowerWordShield && me->GetHealth()*100 / me->GetMaxHealth() <= 25) + { + DoCast(me, SPELL_POWERWORDSHIELD); + PowerWordShield = true; + } + + //Dispel_Timer + if (Dispel_Timer <= diff) + { + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + DoCast(pTarget, SPELL_DISPELMAGIC); + + DispelMagic_Timer = 30000; + } else DispelMagic_Timer -= diff; + + //CurseOfBlood_Timer + if (CurseOfBlood_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_CURSEOFBLOOD); + CurseOfBlood_Timer = 25000; + } else CurseOfBlood_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_high_inquisitor_fairbanks(Creature* pCreature) -{ - return new boss_high_inquisitor_fairbanksAI (pCreature); -} void AddSC_boss_high_inquisitor_fairbanks() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_high_inquisitor_fairbanks"; - newscript->GetAI = &GetAI_boss_high_inquisitor_fairbanks; - newscript->RegisterSelf(); + new boss_high_inquisitor_fairbanks(); } - diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_houndmaster_loksey.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_houndmaster_loksey.cpp index 324f28ccf6a..7be699e5300 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_houndmaster_loksey.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_houndmaster_loksey.cpp @@ -31,49 +31,51 @@ enum eEnums SPELL_SUMMONSCARLETHOUND = 17164, SPELL_BLOODLUST = 6742 }; - -struct boss_houndmaster_lokseyAI : public ScriptedAI +
class boss_houndmaster_loksey : public CreatureScript { - boss_houndmaster_lokseyAI(Creature *c) : ScriptedAI(c) {} - - uint32 BloodLust_Timer; +public: + boss_houndmaster_loksey() : CreatureScript("boss_houndmaster_loksey") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - BloodLust_Timer = 20000; + return new boss_houndmaster_lokseyAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_houndmaster_lokseyAI : public ScriptedAI { - DoScriptText(SAY_AGGRO, me); - } + boss_houndmaster_lokseyAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + uint32 BloodLust_Timer; - if (BloodLust_Timer <= diff) + void Reset() { - DoCast(me, SPELL_BLOODLUST); BloodLust_Timer = 20000; - } else BloodLust_Timer -= diff; + } + + void EnterCombat(Unit * /*who*/) + { + DoScriptText(SAY_AGGRO, me); + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if (BloodLust_Timer <= diff) + { + DoCast(me, SPELL_BLOODLUST); + BloodLust_Timer = 20000; + } else BloodLust_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_houndmaster_loksey(Creature* pCreature) -{ - return new boss_houndmaster_lokseyAI (pCreature); -} void AddSC_boss_houndmaster_loksey() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_houndmaster_loksey"; - newscript->GetAI = &GetAI_boss_houndmaster_loksey; - newscript->RegisterSelf(); + new boss_houndmaster_loksey(); } - diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_interrogator_vishas.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_interrogator_vishas.cpp index d804a680e76..325a83bf997 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_interrogator_vishas.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_interrogator_vishas.cpp @@ -36,85 +36,87 @@ enum eEnums SPELL_SHADOWWORDPAIN = 2767, }; - -struct boss_interrogator_vishasAI : public ScriptedAI +
class boss_interrogator_vishas : public CreatureScript { - boss_interrogator_vishasAI(Creature *c) : ScriptedAI(c) - { - pInstance = me->GetInstanceData(); - } +public: + boss_interrogator_vishas() : CreatureScript("boss_interrogator_vishas") { } - ScriptedInstance* pInstance; - - bool Yell30; - bool Yell60; - uint32 ShadowWordPain_Timer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - ShadowWordPain_Timer = 5000; + return new boss_interrogator_vishasAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_interrogator_vishasAI : public ScriptedAI { - DoScriptText(SAY_AGGRO, me); - } + boss_interrogator_vishasAI(Creature *c) : ScriptedAI(c) + { + pInstance = me->GetInstanceScript(); + } - void KilledUnit(Unit* /*Victim*/) - { - DoScriptText(SAY_KILL, me); - } + InstanceScript* pInstance; - void JustDied(Unit* /*Killer*/) - { - if (!pInstance) - return; + bool Yell30; + bool Yell60; + uint32 ShadowWordPain_Timer; - //Any other actions to do with vorrel? setStandState? - if (Unit *vorrel = Unit::GetUnit(*me,pInstance->GetData64(DATA_VORREL))) - DoScriptText(SAY_TRIGGER_VORREL, vorrel); - } + void Reset() + { + ShadowWordPain_Timer = 5000; + } - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + void EnterCombat(Unit * /*who*/) + { + DoScriptText(SAY_AGGRO, me); + } - //If we are low on hp Do sayings - if (!Yell60 && ((me->GetHealth()*100) / me->GetMaxHealth() <= 60)) + void KilledUnit(Unit* /*Victim*/) { - DoScriptText(SAY_HEALTH1, me); - Yell60 = true; + DoScriptText(SAY_KILL, me); } - if (!Yell30 && ((me->GetHealth()*100) / me->GetMaxHealth() <= 30)) + void JustDied(Unit* /*Killer*/) { - DoScriptText(SAY_HEALTH2, me); - Yell30 = true; + if (!pInstance) + return; + + //Any other actions to do with vorrel? setStandState? + if (Unit *vorrel = Unit::GetUnit(*me,pInstance->GetData64(DATA_VORREL))) + DoScriptText(SAY_TRIGGER_VORREL, vorrel); } - //ShadowWordPain_Timer - if (ShadowWordPain_Timer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_SHADOWWORDPAIN); - ShadowWordPain_Timer = 5000 + rand()%10000; - } else ShadowWordPain_Timer -= diff; + if (!UpdateVictim()) + return; + + //If we are low on hp Do sayings + if (!Yell60 && ((me->GetHealth()*100) / me->GetMaxHealth() <= 60)) + { + DoScriptText(SAY_HEALTH1, me); + Yell60 = true; + } + + if (!Yell30 && ((me->GetHealth()*100) / me->GetMaxHealth() <= 30)) + { + DoScriptText(SAY_HEALTH2, me); + Yell30 = true; + } + + //ShadowWordPain_Timer + if (ShadowWordPain_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_SHADOWWORDPAIN); + ShadowWordPain_Timer = 5000 + rand()%10000; + } else ShadowWordPain_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_interrogator_vishas(Creature* pCreature) -{ - return new boss_interrogator_vishasAI (pCreature); -} void AddSC_boss_interrogator_vishas() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_interrogator_vishas"; - newscript->GetAI = &GetAI_boss_interrogator_vishas; - newscript->RegisterSelf(); + new boss_interrogator_vishas(); } - diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp index 2d4f7e8e244..d10c6580611 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp @@ -52,310 +52,314 @@ enum eEnums SPELL_HEAL = 12039, SPELL_POWERWORDSHIELD = 22187 }; - -struct boss_scarlet_commander_mograineAI : public ScriptedAI +
class boss_scarlet_commander_mograine : public CreatureScript { - boss_scarlet_commander_mograineAI(Creature* pCreature) : ScriptedAI(pCreature) +public: + boss_scarlet_commander_mograine() : CreatureScript("boss_scarlet_commander_mograine") { } + + CreatureAI* GetAI(Creature* pCreature) const { - m_pInstance = pCreature->GetInstanceData(); + return new boss_scarlet_commander_mograineAI (pCreature); } - ScriptedInstance* m_pInstance; + struct boss_scarlet_commander_mograineAI : public ScriptedAI + { + boss_scarlet_commander_mograineAI(Creature* pCreature) : ScriptedAI(pCreature) + { + m_pInstance = pCreature->GetInstanceScript(); + } - uint32 m_uiCrusaderStrike_Timer; - uint32 m_uiHammerOfJustice_Timer; + InstanceScript* m_pInstance; - bool m_bHasDied; - bool m_bHeal; - bool m_bFakeDeath; + uint32 m_uiCrusaderStrike_Timer; + uint32 m_uiHammerOfJustice_Timer; - void Reset() - { - m_uiCrusaderStrike_Timer = 10000; - m_uiHammerOfJustice_Timer = 10000; + bool m_bHasDied; + bool m_bHeal; + bool m_bFakeDeath; + + void Reset() + { + m_uiCrusaderStrike_Timer = 10000; + m_uiHammerOfJustice_Timer = 10000; - //Incase wipe during phase that mograine fake death - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->SetStandState(UNIT_STAND_STATE_STAND); + //Incase wipe during phase that mograine fake death + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetStandState(UNIT_STAND_STATE_STAND); - if (m_pInstance) - if (me->isAlive()) - m_pInstance->SetData(TYPE_MOGRAINE_AND_WHITE_EVENT,NOT_STARTED); + if (m_pInstance) + if (me->isAlive()) + m_pInstance->SetData(TYPE_MOGRAINE_AND_WHITE_EVENT,NOT_STARTED); - m_bHasDied = false; - m_bHeal = false; - m_bFakeDeath = false; - } + m_bHasDied = false; + m_bHeal = false; + m_bFakeDeath = false; + } - void JustReachedHome() - { - if (m_pInstance) + void JustReachedHome() { - if (m_pInstance->GetData(TYPE_MOGRAINE_AND_WHITE_EVENT != NOT_STARTED)) - m_pInstance->SetData(TYPE_MOGRAINE_AND_WHITE_EVENT, FAIL); + if (m_pInstance) + { + if (m_pInstance->GetData(TYPE_MOGRAINE_AND_WHITE_EVENT != NOT_STARTED)) + m_pInstance->SetData(TYPE_MOGRAINE_AND_WHITE_EVENT, FAIL); + } } - } - void EnterCombat(Unit* /*pWho*/) - { - DoScriptText(SAY_MO_AGGRO, me); - DoCast(me, SPELL_RETRIBUTIONAURA); + void EnterCombat(Unit* /*pWho*/) + { + DoScriptText(SAY_MO_AGGRO, me); + DoCast(me, SPELL_RETRIBUTIONAURA); - me->CallForHelp(VISIBLE_RANGE); - } + me->CallForHelp(VISIBLE_RANGE); + } - void KilledUnit(Unit* /*pVictim*/) - { - DoScriptText(SAY_MO_KILL, me); - } + void KilledUnit(Unit* /*pVictim*/) + { + DoScriptText(SAY_MO_KILL, me); + } - void DamageTaken(Unit* /*pDoneBy*/, uint32 &uiDamage) - { - if (uiDamage < me->GetHealth() || m_bHasDied || m_bFakeDeath) - return; + void DamageTaken(Unit* /*pDoneBy*/, uint32 &uiDamage) + { + if (uiDamage < me->GetHealth() || m_bHasDied || m_bFakeDeath) + return; - if (!m_pInstance) - return; + if (!m_pInstance) + return; - //On first death, fake death and open door, as well as initiate whitemane if exist - if (Unit* Whitemane = Unit::GetUnit((*me), m_pInstance->GetData64(DATA_WHITEMANE))) - { - m_pInstance->SetData(TYPE_MOGRAINE_AND_WHITE_EVENT, IN_PROGRESS); + //On first death, fake death and open door, as well as initiate whitemane if exist + if (Unit* Whitemane = Unit::GetUnit((*me), m_pInstance->GetData64(DATA_WHITEMANE))) + { + m_pInstance->SetData(TYPE_MOGRAINE_AND_WHITE_EVENT, IN_PROGRESS); - Whitemane->GetMotionMaster()->MovePoint(1,1163.113370,1398.856812,32.527786); + Whitemane->GetMotionMaster()->MovePoint(1,1163.113370,1398.856812,32.527786); - me->GetMotionMaster()->MovementExpired(); - me->GetMotionMaster()->MoveIdle(); + me->GetMotionMaster()->MovementExpired(); + me->GetMotionMaster()->MoveIdle(); - me->SetHealth(0); + me->SetHealth(0); - if (me->IsNonMeleeSpellCasted(false)) - me->InterruptNonMeleeSpells(false); + if (me->IsNonMeleeSpellCasted(false)) + me->InterruptNonMeleeSpells(false); - me->ClearComboPointHolders(); - me->RemoveAllAuras(); - me->ClearAllReactives(); + me->ClearComboPointHolders(); + me->RemoveAllAuras(); + me->ClearAllReactives(); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->SetStandState(UNIT_STAND_STATE_DEAD); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetStandState(UNIT_STAND_STATE_DEAD); - m_bHasDied = true; - m_bFakeDeath = true; + m_bHasDied = true; + m_bFakeDeath = true; - uiDamage = 0; + uiDamage = 0; + } } - } - void SpellHit(Unit* /*pWho*/, const SpellEntry* pSpell) - { - //When hit with ressurection say text - if (pSpell->Id == SPELL_SCARLETRESURRECTION) + void SpellHit(Unit* /*pWho*/, const SpellEntry* pSpell) { - DoScriptText(SAY_MO_RESSURECTED, me); - m_bFakeDeath = false; + //When hit with ressurection say text + if (pSpell->Id == SPELL_SCARLETRESURRECTION) + { + DoScriptText(SAY_MO_RESSURECTED, me); + m_bFakeDeath = false; - if (m_pInstance) - m_pInstance->SetData(TYPE_MOGRAINE_AND_WHITE_EVENT, SPECIAL); + if (m_pInstance) + m_pInstance->SetData(TYPE_MOGRAINE_AND_WHITE_EVENT, SPECIAL); + } } - } - - void UpdateAI(const uint32 uiDiff) - { - if (!UpdateVictim()) - return; - if (m_bHasDied && !m_bHeal && m_pInstance && m_pInstance->GetData(TYPE_MOGRAINE_AND_WHITE_EVENT) == SPECIAL) + void UpdateAI(const uint32 uiDiff) { - //On ressurection, stop fake death and heal whitemane and resume fight - if (Unit* Whitemane = Unit::GetUnit((*me), m_pInstance->GetData64(DATA_WHITEMANE))) + if (!UpdateVictim()) + return; + + if (m_bHasDied && !m_bHeal && m_pInstance && m_pInstance->GetData(TYPE_MOGRAINE_AND_WHITE_EVENT) == SPECIAL) { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->SetStandState(UNIT_STAND_STATE_STAND); - DoCast(Whitemane, SPELL_LAYONHANDS); + //On ressurection, stop fake death and heal whitemane and resume fight + if (Unit* Whitemane = Unit::GetUnit((*me), m_pInstance->GetData64(DATA_WHITEMANE))) + { + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetStandState(UNIT_STAND_STATE_STAND); + DoCast(Whitemane, SPELL_LAYONHANDS); - m_uiCrusaderStrike_Timer = 10000; - m_uiHammerOfJustice_Timer = 10000; + m_uiCrusaderStrike_Timer = 10000; + m_uiHammerOfJustice_Timer = 10000; - if (me->getVictim()) - me->GetMotionMaster()->MoveChase(me->getVictim()); + if (me->getVictim()) + me->GetMotionMaster()->MoveChase(me->getVictim()); - m_bHeal = true; + m_bHeal = true; + } } - } - //This if-check to make sure mograine does not attack while fake death - if (m_bFakeDeath) - return; + //This if-check to make sure mograine does not attack while fake death + if (m_bFakeDeath) + return; - //m_uiCrusaderStrike_Timer - if (m_uiCrusaderStrike_Timer <= uiDiff) - { - DoCast(me->getVictim(), SPELL_CRUSADERSTRIKE); - m_uiCrusaderStrike_Timer = 10000; - } else m_uiCrusaderStrike_Timer -= uiDiff; + //m_uiCrusaderStrike_Timer + if (m_uiCrusaderStrike_Timer <= uiDiff) + { + DoCast(me->getVictim(), SPELL_CRUSADERSTRIKE); + m_uiCrusaderStrike_Timer = 10000; + } else m_uiCrusaderStrike_Timer -= uiDiff; - //m_uiHammerOfJustice_Timer - if (m_uiHammerOfJustice_Timer <= uiDiff) - { - DoCast(me->getVictim(), SPELL_HAMMEROFJUSTICE); - m_uiHammerOfJustice_Timer = 60000; - } else m_uiHammerOfJustice_Timer -= uiDiff; + //m_uiHammerOfJustice_Timer + if (m_uiHammerOfJustice_Timer <= uiDiff) + { + DoCast(me->getVictim(), SPELL_HAMMEROFJUSTICE); + m_uiHammerOfJustice_Timer = 60000; + } else m_uiHammerOfJustice_Timer -= uiDiff; - DoMeleeAttackIfReady(); - } -}; + DoMeleeAttackIfReady(); + } + }; -struct boss_high_inquisitor_whitemaneAI : public ScriptedAI +}; +
class boss_high_inquisitor_whitemane : public CreatureScript { - boss_high_inquisitor_whitemaneAI(Creature* pCreature) : ScriptedAI(pCreature) +public: + boss_high_inquisitor_whitemane() : CreatureScript("boss_high_inquisitor_whitemane") { } + + CreatureAI* GetAI(Creature* pCreature) const { - m_pInstance = pCreature->GetInstanceData(); + return new boss_high_inquisitor_whitemaneAI (pCreature); } - ScriptedInstance* m_pInstance; + struct boss_high_inquisitor_whitemaneAI : public ScriptedAI + { + boss_high_inquisitor_whitemaneAI(Creature* pCreature) : ScriptedAI(pCreature) + { + m_pInstance = pCreature->GetInstanceScript(); + } - uint32 m_uiHeal_Timer; - uint32 m_uiPowerWordShield_Timer; - uint32 m_uiHolySmite_Timer; - uint32 m_uiWait_Timer; + InstanceScript* m_pInstance; - bool m_bCanResurrectCheck; - bool m_bCanResurrect; + uint32 m_uiHeal_Timer; + uint32 m_uiPowerWordShield_Timer; + uint32 m_uiHolySmite_Timer; + uint32 m_uiWait_Timer; - void Reset() - { - m_uiWait_Timer = 7000; - m_uiHeal_Timer = 10000; - m_uiPowerWordShield_Timer = 15000; - m_uiHolySmite_Timer = 6000; + bool m_bCanResurrectCheck; + bool m_bCanResurrect; - m_bCanResurrectCheck = false; - m_bCanResurrect = false; + void Reset() + { + m_uiWait_Timer = 7000; + m_uiHeal_Timer = 10000; + m_uiPowerWordShield_Timer = 15000; + m_uiHolySmite_Timer = 6000; - if (m_pInstance) - if (me->isAlive()) - m_pInstance->SetData(TYPE_MOGRAINE_AND_WHITE_EVENT, NOT_STARTED); - } + m_bCanResurrectCheck = false; + m_bCanResurrect = false; - void AttackStart(Unit* pWho) - { - if (m_pInstance && m_pInstance->GetData(TYPE_MOGRAINE_AND_WHITE_EVENT) == NOT_STARTED) - return; + if (m_pInstance) + if (me->isAlive()) + m_pInstance->SetData(TYPE_MOGRAINE_AND_WHITE_EVENT, NOT_STARTED); + } - ScriptedAI::AttackStart(pWho); - } + void AttackStart(Unit* pWho) + { + if (m_pInstance && m_pInstance->GetData(TYPE_MOGRAINE_AND_WHITE_EVENT) == NOT_STARTED) + return; - void EnterCombat(Unit* /*pWho*/) - { - DoScriptText(SAY_WH_INTRO, me); - } + ScriptedAI::AttackStart(pWho); + } - void KilledUnit(Unit* /*pVictim*/) - { - DoScriptText(SAY_WH_KILL, me); - } + void EnterCombat(Unit* /*pWho*/) + { + DoScriptText(SAY_WH_INTRO, me); + } - void UpdateAI(const uint32 uiDiff) - { - if (!UpdateVictim()) - return; + void KilledUnit(Unit* /*pVictim*/) + { + DoScriptText(SAY_WH_KILL, me); + } - if (m_bCanResurrect) + void UpdateAI(const uint32 uiDiff) { - //When casting resuruction make sure to delay so on rez when reinstate battle deepsleep runs out - if (m_pInstance && m_uiWait_Timer <= uiDiff) + if (!UpdateVictim()) + return; + + if (m_bCanResurrect) { - if (Unit* Mograine = Unit::GetUnit((*me), m_pInstance->GetData64(DATA_MOGRAINE))) + //When casting resuruction make sure to delay so on rez when reinstate battle deepsleep runs out + if (m_pInstance && m_uiWait_Timer <= uiDiff) { - DoCast(Mograine, SPELL_SCARLETRESURRECTION); - DoScriptText(SAY_WH_RESSURECT, me); - m_bCanResurrect = false; + if (Unit* Mograine = Unit::GetUnit((*me), m_pInstance->GetData64(DATA_MOGRAINE))) + { + DoCast(Mograine, SPELL_SCARLETRESURRECTION); + DoScriptText(SAY_WH_RESSURECT, me); + m_bCanResurrect = false; + } } + else m_uiWait_Timer -= uiDiff; } - else m_uiWait_Timer -= uiDiff; - } - //Cast Deep sleep when health is less than 50% - if (!m_bCanResurrectCheck && me->GetHealth()*100 / me->GetMaxHealth() <= 50) - { - if (me->IsNonMeleeSpellCasted(false)) - me->InterruptNonMeleeSpells(false); + //Cast Deep sleep when health is less than 50% + if (!m_bCanResurrectCheck && me->GetHealth()*100 / me->GetMaxHealth() <= 50) + { + if (me->IsNonMeleeSpellCasted(false)) + me->InterruptNonMeleeSpells(false); - DoCast(me->getVictim(), SPELL_DEEPSLEEP); - m_bCanResurrectCheck = true; - m_bCanResurrect = true; - return; - } + DoCast(me->getVictim(), SPELL_DEEPSLEEP); + m_bCanResurrectCheck = true; + m_bCanResurrect = true; + return; + } - //while in "resurrect-mode", don't do anything - if (m_bCanResurrect) - return; + //while in "resurrect-mode", don't do anything + if (m_bCanResurrect) + return; - //If we are <75% hp cast healing spells at self or Mograine - if (m_uiHeal_Timer <= uiDiff) - { - Creature* pTarget = NULL; + //If we are <75% hp cast healing spells at self or Mograine + if (m_uiHeal_Timer <= uiDiff) + { + Creature* pTarget = NULL; - if (me->GetHealth() <= me->GetMaxHealth()*0.75f) - pTarget = me; + if (me->GetHealth() <= me->GetMaxHealth()*0.75f) + pTarget = me; - if (m_pInstance) - { - if (Creature* pMograine = Unit::GetCreature((*me), m_pInstance->GetData64(DATA_MOGRAINE))) + if (m_pInstance) { - // checking m_bCanResurrectCheck prevents her healing Mograine while he is "faking death" - if (m_bCanResurrectCheck && pMograine->isAlive() && pMograine->GetHealth() <= pMograine->GetMaxHealth()*0.75f) - pTarget = pMograine; + if (Creature* pMograine = Unit::GetCreature((*me), m_pInstance->GetData64(DATA_MOGRAINE))) + { + // checking m_bCanResurrectCheck prevents her healing Mograine while he is "faking death" + if (m_bCanResurrectCheck && pMograine->isAlive() && pMograine->GetHealth() <= pMograine->GetMaxHealth()*0.75f) + pTarget = pMograine; + } } - } - if (pTarget) - DoCast(pTarget, SPELL_HEAL); + if (pTarget) + DoCast(pTarget, SPELL_HEAL); - m_uiHeal_Timer = 13000; - } else m_uiHeal_Timer -= uiDiff; + m_uiHeal_Timer = 13000; + } else m_uiHeal_Timer -= uiDiff; - //m_uiPowerWordShield_Timer - if (m_uiPowerWordShield_Timer <= uiDiff) - { - DoCast(me, SPELL_POWERWORDSHIELD); - m_uiPowerWordShield_Timer = 15000; - } else m_uiPowerWordShield_Timer -= uiDiff; + //m_uiPowerWordShield_Timer + if (m_uiPowerWordShield_Timer <= uiDiff) + { + DoCast(me, SPELL_POWERWORDSHIELD); + m_uiPowerWordShield_Timer = 15000; + } else m_uiPowerWordShield_Timer -= uiDiff; - //m_uiHolySmite_Timer - if (m_uiHolySmite_Timer <= uiDiff) - { - DoCast(me->getVictim(), SPELL_HOLYSMITE); - m_uiHolySmite_Timer = 6000; - } else m_uiHolySmite_Timer -= uiDiff; + //m_uiHolySmite_Timer + if (m_uiHolySmite_Timer <= uiDiff) + { + DoCast(me->getVictim(), SPELL_HOLYSMITE); + m_uiHolySmite_Timer = 6000; + } else m_uiHolySmite_Timer -= uiDiff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_scarlet_commander_mograine(Creature* pCreature) -{ - return new boss_scarlet_commander_mograineAI (pCreature); -} -CreatureAI* GetAI_boss_high_inquisitor_whitemane(Creature* pCreature) -{ - return new boss_high_inquisitor_whitemaneAI (pCreature); -} void AddSC_boss_mograine_and_whitemane() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_scarlet_commander_mograine"; - newscript->GetAI = &GetAI_boss_scarlet_commander_mograine; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_high_inquisitor_whitemane"; - newscript->GetAI = &GetAI_boss_high_inquisitor_whitemane; - newscript->RegisterSelf(); + new boss_scarlet_commander_mograine(); + new boss_high_inquisitor_whitemane(); } - diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_scorn.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_scorn.cpp index f37903d09e1..12ab173ed98 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_scorn.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_scorn.cpp @@ -29,75 +29,77 @@ EndScriptData */ #define SPELL_FROSTBOLTVOLLEY 8398 #define SPELL_MINDFLAY 17313 #define SPELL_FROSTNOVA 15531 - -struct boss_scornAI : public ScriptedAI +
class boss_scorn : public CreatureScript { - boss_scornAI(Creature *c) : ScriptedAI(c) {} - - uint32 LichSlap_Timer; - uint32 FrostboltVolley_Timer; - uint32 MindFlay_Timer; - uint32 FrostNova_Timer; +public: + boss_scorn() : CreatureScript("boss_scorn") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - LichSlap_Timer = 45000; - FrostboltVolley_Timer = 30000; - MindFlay_Timer = 30000; - FrostNova_Timer = 30000; + return new boss_scornAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_scornAI : public ScriptedAI { - } + boss_scornAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + uint32 LichSlap_Timer; + uint32 FrostboltVolley_Timer; + uint32 MindFlay_Timer; + uint32 FrostNova_Timer; - //LichSlap_Timer - if (LichSlap_Timer <= diff) + void Reset() { - DoCast(me->getVictim(), SPELL_LICHSLAP); LichSlap_Timer = 45000; - } else LichSlap_Timer -= diff; + FrostboltVolley_Timer = 30000; + MindFlay_Timer = 30000; + FrostNova_Timer = 30000; + } - //FrostboltVolley_Timer - if (FrostboltVolley_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - DoCast(me->getVictim(), SPELL_FROSTBOLTVOLLEY); - FrostboltVolley_Timer = 20000; - } else FrostboltVolley_Timer -= diff; + } - //MindFlay_Timer - if (MindFlay_Timer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_MINDFLAY); - MindFlay_Timer = 20000; - } else MindFlay_Timer -= diff; + if (!UpdateVictim()) + return; - //FrostNova_Timer - if (FrostNova_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_FROSTNOVA); - FrostNova_Timer = 15000; - } else FrostNova_Timer -= diff; + //LichSlap_Timer + if (LichSlap_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_LICHSLAP); + LichSlap_Timer = 45000; + } else LichSlap_Timer -= diff; + + //FrostboltVolley_Timer + if (FrostboltVolley_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_FROSTBOLTVOLLEY); + FrostboltVolley_Timer = 20000; + } else FrostboltVolley_Timer -= diff; + + //MindFlay_Timer + if (MindFlay_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_MINDFLAY); + MindFlay_Timer = 20000; + } else MindFlay_Timer -= diff; + + //FrostNova_Timer + if (FrostNova_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_FROSTNOVA); + FrostNova_Timer = 15000; + } else FrostNova_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_scorn(Creature* pCreature) -{ - return new boss_scornAI (pCreature); -} void AddSC_boss_scorn() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_scorn"; - newscript->GetAI = &GetAI_boss_scorn; - newscript->RegisterSelf(); + new boss_scorn(); } - diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/instance_scarlet_monastery.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/instance_scarlet_monastery.cpp index dd7a88dbc88..873092a6043 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/instance_scarlet_monastery.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/instance_scarlet_monastery.cpp @@ -32,128 +32,130 @@ EndScriptData */ #define ENTRY_PUMPKIN 23694 #define MAX_ENCOUNTER 2 - -struct instance_scarlet_monastery : public ScriptedInstance +
class instance_scarlet_monastery : public InstanceMapScript { - instance_scarlet_monastery(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; +public: + instance_scarlet_monastery() : InstanceMapScript("instance_scarlet_monastery") { } - uint64 PumpkinShrineGUID; - uint64 HorsemanGUID; - uint64 HeadGUID; - std::set<uint64> HorsemanAdds; + InstanceScript* GetInstanceData_InstanceMapScript(Map* pMap) + { + return new instance_scarlet_monastery_InstanceMapScript(pMap); + } - uint64 MograineGUID; - uint64 WhitemaneGUID; - uint64 VorrelGUID; - uint64 DoorHighInquisitorGUID; + struct instance_scarlet_monastery_InstanceMapScript : public InstanceScript + { + instance_scarlet_monastery_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {Initialize();}; - uint32 m_auiEncounter[MAX_ENCOUNTER]; + uint64 PumpkinShrineGUID; + uint64 HorsemanGUID; + uint64 HeadGUID; + std::set<uint64> HorsemanAdds; - void Initialize() - { - memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); + uint64 MograineGUID; + uint64 WhitemaneGUID; + uint64 VorrelGUID; + uint64 DoorHighInquisitorGUID; - PumpkinShrineGUID = 0; - HorsemanGUID = 0; - HeadGUID = 0; - HorsemanAdds.clear(); + uint32 m_auiEncounter[MAX_ENCOUNTER]; - MograineGUID = 0; - WhitemaneGUID = 0; - VorrelGUID = 0; - DoorHighInquisitorGUID = 0; - } + void Initialize() + { + memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - void OnGameObjectCreate(GameObject* pGo, bool /*add*/) - { - switch(pGo->GetEntry()) + PumpkinShrineGUID = 0; + HorsemanGUID = 0; + HeadGUID = 0; + HorsemanAdds.clear(); + + MograineGUID = 0; + WhitemaneGUID = 0; + VorrelGUID = 0; + DoorHighInquisitorGUID = 0; + } + + void OnGameObjectCreate(GameObject* pGo, bool /*add*/) { - case ENTRY_PUMPKIN_SHRINE: PumpkinShrineGUID = pGo->GetGUID();break; - case 104600: DoorHighInquisitorGUID = pGo->GetGUID(); break; + switch(pGo->GetEntry()) + { + case ENTRY_PUMPKIN_SHRINE: PumpkinShrineGUID = pGo->GetGUID();break; + case 104600: DoorHighInquisitorGUID = pGo->GetGUID(); break; + } } - } - void OnCreatureCreate(Creature* pCreature, bool /*add*/) - { - switch(pCreature->GetEntry()) + void OnCreatureCreate(Creature* pCreature, bool /*add*/) { - case ENTRY_HORSEMAN: HorsemanGUID = pCreature->GetGUID(); break; - case ENTRY_HEAD: HeadGUID = pCreature->GetGUID(); break; - case ENTRY_PUMPKIN: HorsemanAdds.insert(pCreature->GetGUID());break; - case 3976: MograineGUID = pCreature->GetGUID(); break; - case 3977: WhitemaneGUID = pCreature->GetGUID(); break; - case 3981: VorrelGUID = pCreature->GetGUID(); break; + switch(pCreature->GetEntry()) + { + case ENTRY_HORSEMAN: HorsemanGUID = pCreature->GetGUID(); break; + case ENTRY_HEAD: HeadGUID = pCreature->GetGUID(); break; + case ENTRY_PUMPKIN: HorsemanAdds.insert(pCreature->GetGUID());break; + case 3976: MograineGUID = pCreature->GetGUID(); break; + case 3977: WhitemaneGUID = pCreature->GetGUID(); break; + case 3981: VorrelGUID = pCreature->GetGUID(); break; + } } - } - void SetData(uint32 type, uint32 data) - { - switch(type) + void SetData(uint32 type, uint32 data) { - case TYPE_MOGRAINE_AND_WHITE_EVENT: - if (data == IN_PROGRESS) - DoUseDoorOrButton(DoorHighInquisitorGUID); - if (data == FAIL) - DoUseDoorOrButton(DoorHighInquisitorGUID); - - m_auiEncounter[0] = data; - break; - case GAMEOBJECT_PUMPKIN_SHRINE: - HandleGameObject(PumpkinShrineGUID, false); - break; - case DATA_HORSEMAN_EVENT: - m_auiEncounter[1] = data; - if (data == DONE) + switch(type) { - for (std::set<uint64>::const_iterator itr = HorsemanAdds.begin(); itr != HorsemanAdds.end(); ++itr) + case TYPE_MOGRAINE_AND_WHITE_EVENT: + if (data == IN_PROGRESS) + DoUseDoorOrButton(DoorHighInquisitorGUID); + if (data == FAIL) + DoUseDoorOrButton(DoorHighInquisitorGUID); + + m_auiEncounter[0] = data; + break; + case GAMEOBJECT_PUMPKIN_SHRINE: + HandleGameObject(PumpkinShrineGUID, false); + break; + case DATA_HORSEMAN_EVENT: + m_auiEncounter[1] = data; + if (data == DONE) { - Creature* add = instance->GetCreature(*itr); - if (add && add->isAlive()) - add->Kill(add); + for (std::set<uint64>::const_iterator itr = HorsemanAdds.begin(); itr != HorsemanAdds.end(); ++itr) + { + Creature* add = instance->GetCreature(*itr); + if (add && add->isAlive()) + add->Kill(add); + } + HorsemanAdds.clear(); + HandleGameObject(PumpkinShrineGUID, false); } - HorsemanAdds.clear(); - HandleGameObject(PumpkinShrineGUID, false); + break; } - break; } - } - uint64 GetData64(uint32 type) - { - switch(type) + uint64 GetData64(uint32 type) { - //case GAMEOBJECT_PUMPKIN_SHRINE: return PumpkinShrineGUID; - //case DATA_HORSEMAN: return HorsemanGUID; - //case DATA_HEAD: return HeadGUID; - case DATA_MOGRAINE: return MograineGUID; - case DATA_WHITEMANE: return WhitemaneGUID; - case DATA_VORREL: return VorrelGUID; - case DATA_DOOR_WHITEMANE: return DoorHighInquisitorGUID; + switch(type) + { + //case GAMEOBJECT_PUMPKIN_SHRINE: return PumpkinShrineGUID; + //case DATA_HORSEMAN: return HorsemanGUID; + //case DATA_HEAD: return HeadGUID; + case DATA_MOGRAINE: return MograineGUID; + case DATA_WHITEMANE: return WhitemaneGUID; + case DATA_VORREL: return VorrelGUID; + case DATA_DOOR_WHITEMANE: return DoorHighInquisitorGUID; + } + return 0; } - return 0; - } - uint32 GetData(uint32 type) - { - if (type == TYPE_MOGRAINE_AND_WHITE_EVENT) - return m_auiEncounter[0]; - if (type == DATA_HORSEMAN_EVENT) - return m_auiEncounter[1]; - return 0; - } + uint32 GetData(uint32 type) + { + if (type == TYPE_MOGRAINE_AND_WHITE_EVENT) + return m_auiEncounter[0]; + if (type == DATA_HORSEMAN_EVENT) + return m_auiEncounter[1]; + return 0; + } + }; + }; -InstanceData* GetInstanceData_instance_scarlet_monastery(Map* pMap) -{ - return new instance_scarlet_monastery(pMap); -} void AddSC_instance_scarlet_monastery() { - Script *newscript; - newscript = new Script; - newscript->Name = "instance_scarlet_monastery"; - newscript->GetInstanceData = &GetInstanceData_instance_scarlet_monastery; - newscript->RegisterSelf(); + new instance_scarlet_monastery(); } - diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_darkmaster_gandling.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_darkmaster_gandling.cpp index 1f2e2fe1429..d4493c0fd1f 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/boss_darkmaster_gandling.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_darkmaster_gandling.cpp @@ -49,179 +49,181 @@ EndScriptData */ #define ADD_4Y 99.373 #define ADD_4Z 104.732 #define ADD_4O 3.16 - -struct boss_darkmaster_gandlingAI : public ScriptedAI +
class boss_darkmaster_gandling : public CreatureScript { - boss_darkmaster_gandlingAI(Creature *c) : ScriptedAI(c) - { - pInstance = me->GetInstanceData(); - } - - ScriptedInstance* pInstance; +public: + boss_darkmaster_gandling() : CreatureScript("boss_darkmaster_gandling") { } - uint32 ArcaneMissiles_Timer; - uint32 ShadowShield_Timer; - uint32 Curse_Timer; - uint32 Teleport_Timer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - ArcaneMissiles_Timer = 4500; - ShadowShield_Timer = 12000; - Curse_Timer = 2000; - Teleport_Timer = 16000; + return new boss_darkmaster_gandlingAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_darkmaster_gandlingAI : public ScriptedAI { - } + boss_darkmaster_gandlingAI(Creature *c) : ScriptedAI(c) + { + pInstance = me->GetInstanceScript(); + } - void JustDied(Unit * /*killer*/) - { - if (pInstance) - pInstance->SetData(TYPE_GANDLING, DONE); - } + InstanceScript* pInstance; - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + uint32 ArcaneMissiles_Timer; + uint32 ShadowShield_Timer; + uint32 Curse_Timer; + uint32 Teleport_Timer; - //ArcaneMissiles_Timer - if (ArcaneMissiles_Timer <= diff) + void Reset() { - DoCast(me->getVictim(), SPELL_ARCANEMISSILES); - ArcaneMissiles_Timer = 8000; - } else ArcaneMissiles_Timer -= diff; + ArcaneMissiles_Timer = 4500; + ShadowShield_Timer = 12000; + Curse_Timer = 2000; + Teleport_Timer = 16000; + } - //ShadowShield_Timer - if (ShadowShield_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - DoCast(me, SPELL_SHADOWSHIELD); - ShadowShield_Timer = 14000 + rand()%14000; - } else ShadowShield_Timer -= diff; + } - //Curse_Timer - if (Curse_Timer <= diff) + void JustDied(Unit * /*killer*/) { - DoCast(me->getVictim(), SPELL_CURSE); - Curse_Timer = 15000 + rand()%12000; - } else Curse_Timer -= diff; + if (pInstance) + pInstance->SetData(TYPE_GANDLING, DONE); + } - //Teleporting Random Target to one of the six pre boss rooms and spawn 3-4 skeletons near the gamer. - //We will only telport if gandling has more than 3% of hp so teleported gamers can always loot. - if (me->GetHealth()*100 / me->GetMaxHealth() > 3) + void UpdateAI(const uint32 diff) { - if (Teleport_Timer <= diff) + if (!UpdateVictim()) + return; + + //ArcaneMissiles_Timer + if (ArcaneMissiles_Timer <= diff) { - Unit *pTarget = NULL; - pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); - if (pTarget && pTarget->GetTypeId() == TYPEID_PLAYER) - { - if (DoGetThreat(pTarget)) - DoModifyThreatPercent(pTarget, -100); + DoCast(me->getVictim(), SPELL_ARCANEMISSILES); + ArcaneMissiles_Timer = 8000; + } else ArcaneMissiles_Timer -= diff; + + //ShadowShield_Timer + if (ShadowShield_Timer <= diff) + { + DoCast(me, SPELL_SHADOWSHIELD); + ShadowShield_Timer = 14000 + rand()%14000; + } else ShadowShield_Timer -= diff; - Creature *Summoned = NULL; - switch(rand()%6) + //Curse_Timer + if (Curse_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_CURSE); + Curse_Timer = 15000 + rand()%12000; + } else Curse_Timer -= diff; + + //Teleporting Random Target to one of the six pre boss rooms and spawn 3-4 skeletons near the gamer. + //We will only telport if gandling has more than 3% of hp so teleported gamers can always loot. + if (me->GetHealth()*100 / me->GetMaxHealth() > 3) + { + if (Teleport_Timer <= diff) + { + Unit *pTarget = NULL; + pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); + if (pTarget && pTarget->GetTypeId() == TYPEID_PLAYER) { - case 0: - DoTeleportPlayer(pTarget, 250.0696,0.3921,84.8408,3.149); - Summoned = me->SummonCreature(16119,254.2325,0.3417,84.8407,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000); - if (Summoned) - Summoned->AI()->AttackStart(pTarget); - Summoned = me->SummonCreature(16119,257.7133,4.0226,84.8407,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000); - if (Summoned) - Summoned->AI()->AttackStart(pTarget); - Summoned = me->SummonCreature(16119,258.6702,-2.60656,84.8407,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000); - if (Summoned) - Summoned->AI()->AttackStart(pTarget); - break; - case 1: - DoTeleportPlayer(pTarget, 181.4220,-91.9481,84.8410,1.608); - Summoned = me->SummonCreature(16119,184.0519,-73.5649,84.8407,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000); - if (Summoned) - Summoned->AI()->AttackStart(pTarget); - Summoned = me->SummonCreature(16119,179.5951,-73.7045,84.8407,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000); - if (Summoned) - Summoned->AI()->AttackStart(pTarget); - Summoned = me->SummonCreature(16119,180.6452,-78.2143,84.8407,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000); - if (Summoned) - Summoned->AI()->AttackStart(pTarget); - Summoned = me->SummonCreature(16119,283.2274,-78.1518,84.8407,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000); - if (Summoned) - Summoned->AI()->AttackStart(pTarget); - break; - case 2: - DoTeleportPlayer(pTarget, 95.1547,-1.8173,85.2289,0.043); - Summoned = me->SummonCreature(16119,100.9404,-1.8016,85.2289,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000); - if (Summoned) - Summoned->AI()->AttackStart(pTarget); - Summoned = me->SummonCreature(16119,101.3729,0.4882,85.2289,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000); - if (Summoned) - Summoned->AI()->AttackStart(pTarget); - Summoned = me->SummonCreature(16119,101.4596,-4.4740,85.2289,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000); - if (Summoned) - Summoned->AI()->AttackStart(pTarget); - break; - case 3: - DoTeleportPlayer(pTarget, 250.0696,0.3921,72.6722,3.149); - Summoned = me->SummonCreature(16119,240.34481,0.7368,72.6722,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000); - if (Summoned) - Summoned->AI()->AttackStart(pTarget); - Summoned = me->SummonCreature(16119,240.3633,-2.9520,72.6722,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000); - if (Summoned) - Summoned->AI()->AttackStart(pTarget); - Summoned = me->SummonCreature(16119,240.6702,3.34949,72.6722,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000); - if (Summoned) - Summoned->AI()->AttackStart(pTarget); - break; - case 4: - DoTeleportPlayer(pTarget, 181.4220,-91.9481,70.7734,1.608); - Summoned = me->SummonCreature(16119,184.0519,-73.5649,70.7734,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000); - if (Summoned) - Summoned->AI()->AttackStart(pTarget); - Summoned = me->SummonCreature(16119,179.5951,-73.7045,70.7734,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000); - if (Summoned) - Summoned->AI()->AttackStart(pTarget); - Summoned = me->SummonCreature(16119,180.6452,-78.2143,70.7734,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000); - if (Summoned) - Summoned->AI()->AttackStart(pTarget); - Summoned = me->SummonCreature(16119,283.2274,-78.1518,70.7734,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000); - if (Summoned) - Summoned->AI()->AttackStart(pTarget); - break; - case 5: - DoTeleportPlayer(pTarget, 106.1541,-1.8994,75.3663,0.043); - Summoned = me->SummonCreature(16119,115.3945,-1.5555,75.3663,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000); - if (Summoned) - Summoned->AI()->AttackStart(pTarget); - Summoned = me->SummonCreature(16119,257.7133,1.8066,75.3663,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000); - if (Summoned) - Summoned->AI()->AttackStart(pTarget); - Summoned = me->SummonCreature(16119,258.6702,-5.1001,75.3663,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000); - if (Summoned) - Summoned->AI()->AttackStart(pTarget); - break; + if (DoGetThreat(pTarget)) + DoModifyThreatPercent(pTarget, -100); + + Creature *Summoned = NULL; + switch(rand()%6) + { + case 0: + DoTeleportPlayer(pTarget, 250.0696,0.3921,84.8408,3.149); + Summoned = me->SummonCreature(16119,254.2325,0.3417,84.8407,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000); + if (Summoned) + Summoned->AI()->AttackStart(pTarget); + Summoned = me->SummonCreature(16119,257.7133,4.0226,84.8407,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000); + if (Summoned) + Summoned->AI()->AttackStart(pTarget); + Summoned = me->SummonCreature(16119,258.6702,-2.60656,84.8407,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000); + if (Summoned) + Summoned->AI()->AttackStart(pTarget); + break; + case 1: + DoTeleportPlayer(pTarget, 181.4220,-91.9481,84.8410,1.608); + Summoned = me->SummonCreature(16119,184.0519,-73.5649,84.8407,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000); + if (Summoned) + Summoned->AI()->AttackStart(pTarget); + Summoned = me->SummonCreature(16119,179.5951,-73.7045,84.8407,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000); + if (Summoned) + Summoned->AI()->AttackStart(pTarget); + Summoned = me->SummonCreature(16119,180.6452,-78.2143,84.8407,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000); + if (Summoned) + Summoned->AI()->AttackStart(pTarget); + Summoned = me->SummonCreature(16119,283.2274,-78.1518,84.8407,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000); + if (Summoned) + Summoned->AI()->AttackStart(pTarget); + break; + case 2: + DoTeleportPlayer(pTarget, 95.1547,-1.8173,85.2289,0.043); + Summoned = me->SummonCreature(16119,100.9404,-1.8016,85.2289,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000); + if (Summoned) + Summoned->AI()->AttackStart(pTarget); + Summoned = me->SummonCreature(16119,101.3729,0.4882,85.2289,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000); + if (Summoned) + Summoned->AI()->AttackStart(pTarget); + Summoned = me->SummonCreature(16119,101.4596,-4.4740,85.2289,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000); + if (Summoned) + Summoned->AI()->AttackStart(pTarget); + break; + case 3: + DoTeleportPlayer(pTarget, 250.0696,0.3921,72.6722,3.149); + Summoned = me->SummonCreature(16119,240.34481,0.7368,72.6722,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000); + if (Summoned) + Summoned->AI()->AttackStart(pTarget); + Summoned = me->SummonCreature(16119,240.3633,-2.9520,72.6722,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000); + if (Summoned) + Summoned->AI()->AttackStart(pTarget); + Summoned = me->SummonCreature(16119,240.6702,3.34949,72.6722,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000); + if (Summoned) + Summoned->AI()->AttackStart(pTarget); + break; + case 4: + DoTeleportPlayer(pTarget, 181.4220,-91.9481,70.7734,1.608); + Summoned = me->SummonCreature(16119,184.0519,-73.5649,70.7734,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000); + if (Summoned) + Summoned->AI()->AttackStart(pTarget); + Summoned = me->SummonCreature(16119,179.5951,-73.7045,70.7734,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000); + if (Summoned) + Summoned->AI()->AttackStart(pTarget); + Summoned = me->SummonCreature(16119,180.6452,-78.2143,70.7734,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000); + if (Summoned) + Summoned->AI()->AttackStart(pTarget); + Summoned = me->SummonCreature(16119,283.2274,-78.1518,70.7734,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000); + if (Summoned) + Summoned->AI()->AttackStart(pTarget); + break; + case 5: + DoTeleportPlayer(pTarget, 106.1541,-1.8994,75.3663,0.043); + Summoned = me->SummonCreature(16119,115.3945,-1.5555,75.3663,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000); + if (Summoned) + Summoned->AI()->AttackStart(pTarget); + Summoned = me->SummonCreature(16119,257.7133,1.8066,75.3663,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000); + if (Summoned) + Summoned->AI()->AttackStart(pTarget); + Summoned = me->SummonCreature(16119,258.6702,-5.1001,75.3663,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000); + if (Summoned) + Summoned->AI()->AttackStart(pTarget); + break; + } } - } - Teleport_Timer = 20000 + rand()%15000; - } else Teleport_Timer -= diff; + Teleport_Timer = 20000 + rand()%15000; + } else Teleport_Timer -= diff; + } + + DoMeleeAttackIfReady(); } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_darkmaster_gandling(Creature* pCreature) -{ - return new boss_darkmaster_gandlingAI (pCreature); -} void AddSC_boss_darkmaster_gandling() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_darkmaster_gandling"; - newscript->GetAI = &GetAI_boss_darkmaster_gandling; - newscript->RegisterSelf(); + new boss_darkmaster_gandling(); } - diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_death_knight_darkreaver.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_death_knight_darkreaver.cpp index c021e9e677e..184bd2a834e 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/boss_death_knight_darkreaver.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_death_knight_darkreaver.cpp @@ -24,37 +24,38 @@ SDCategory: Scholomance EndScriptData */ #include "ScriptPCH.h" - -struct boss_death_knight_darkreaverAI : public ScriptedAI +
class boss_death_knight_darkreaver : public CreatureScript { - boss_death_knight_darkreaverAI(Creature *c) : ScriptedAI(c) {} +public: + boss_death_knight_darkreaver() : CreatureScript("boss_death_knight_darkreaver") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { + return new boss_death_knight_darkreaverAI (pCreature); } - void DamageTaken(Unit * /*done_by*/, uint32 &damage) + struct boss_death_knight_darkreaverAI : public ScriptedAI { - if (me->GetHealth() <= damage) - DoCast(me, 23261, true); //Summon Darkreaver's Fallen Charger - } + boss_death_knight_darkreaverAI(Creature *c) : ScriptedAI(c) {} + + void Reset() + { + } + + void DamageTaken(Unit * /*done_by*/, uint32 &damage) + { + if (me->GetHealth() <= damage) + DoCast(me, 23261, true); //Summon Darkreaver's Fallen Charger + } + + void EnterCombat(Unit * /*who*/) + { + } + }; - void EnterCombat(Unit * /*who*/) - { - } }; -CreatureAI* GetAI_boss_death_knight_darkreaver(Creature* pCreature) -{ - return new boss_death_knight_darkreaverAI (pCreature); -} void AddSC_boss_death_knight_darkreaver() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_death_knight_darkreaver"; - newscript->GetAI = &GetAI_boss_death_knight_darkreaver; - newscript->RegisterSelf(); + new boss_death_knight_darkreaver(); } - diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_doctor_theolen_krastinov.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_doctor_theolen_krastinov.cpp index 24b5bafd57c..eac38cc88e2 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/boss_doctor_theolen_krastinov.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_doctor_theolen_krastinov.cpp @@ -34,86 +34,88 @@ enum eEnums SPELL_BACKHAND = 18103, SPELL_FRENZY = 8269 }; - -struct boss_theolenkrastinovAI : public ScriptedAI +
class boss_doctor_theolen_krastinov : public CreatureScript { - boss_theolenkrastinovAI(Creature *c) : ScriptedAI(c) {} - - uint32 m_uiRend_Timer; - uint32 m_uiBackhand_Timer; - uint32 m_uiFrenzy_Timer; +public: + boss_doctor_theolen_krastinov() : CreatureScript("boss_doctor_theolen_krastinov") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - m_uiRend_Timer = 8000; - m_uiBackhand_Timer = 9000; - m_uiFrenzy_Timer = 1000; + return new boss_theolenkrastinovAI (pCreature); } - void JustDied(Unit* /*pKiller*/) + struct boss_theolenkrastinovAI : public ScriptedAI { - ScriptedInstance* pInstance = me->GetInstanceData(); - if (pInstance) - { - pInstance->SetData(DATA_DOCTORTHEOLENKRASTINOV_DEATH, 0); + boss_theolenkrastinovAI(Creature *c) : ScriptedAI(c) {} - if (pInstance->GetData(TYPE_GANDLING) == IN_PROGRESS) - me->SummonCreature(1853, 180.73, -9.43856, 75.507, 1.61399, TEMPSUMMON_DEAD_DESPAWN, 0); - } - } + uint32 m_uiRend_Timer; + uint32 m_uiBackhand_Timer; + uint32 m_uiFrenzy_Timer; - void UpdateAI(const uint32 uiDiff) - { - if (!UpdateVictim()) - return; - - //Rend_Timer - if (m_uiRend_Timer <= uiDiff) + void Reset() { - DoCast(me->getVictim(), SPELL_REND); - m_uiRend_Timer = 10000; + m_uiRend_Timer = 8000; + m_uiBackhand_Timer = 9000; + m_uiFrenzy_Timer = 1000; } - else - m_uiRend_Timer -= uiDiff; - //Backhand_Timer - if (m_uiBackhand_Timer <= uiDiff) + void JustDied(Unit* /*pKiller*/) { - DoCast(me->getVictim(), SPELL_BACKHAND); - m_uiBackhand_Timer = 10000; + InstanceScript* pInstance = me->GetInstanceScript(); + if (pInstance) + { + pInstance->SetData(DATA_DOCTORTHEOLENKRASTINOV_DEATH, 0); + + if (pInstance->GetData(TYPE_GANDLING) == IN_PROGRESS) + me->SummonCreature(1853, 180.73, -9.43856, 75.507, 1.61399, TEMPSUMMON_DEAD_DESPAWN, 0); + } } - else - m_uiBackhand_Timer -= uiDiff; - //Frenzy_Timer - if (me->GetHealth()*100 / me->GetMaxHealth() < 26) + void UpdateAI(const uint32 uiDiff) { - if (m_uiFrenzy_Timer <= uiDiff) + if (!UpdateVictim()) + return; + + //Rend_Timer + if (m_uiRend_Timer <= uiDiff) { - DoCast(me, SPELL_FRENZY); - DoScriptText(EMOTE_GENERIC_FRENZY_KILL, me); + DoCast(me->getVictim(), SPELL_REND); + m_uiRend_Timer = 10000; + } + else + m_uiRend_Timer -= uiDiff; - m_uiFrenzy_Timer = 120000; + //Backhand_Timer + if (m_uiBackhand_Timer <= uiDiff) + { + DoCast(me->getVictim(), SPELL_BACKHAND); + m_uiBackhand_Timer = 10000; } else - m_uiFrenzy_Timer -= uiDiff; + m_uiBackhand_Timer -= uiDiff; + + //Frenzy_Timer + if (me->GetHealth()*100 / me->GetMaxHealth() < 26) + { + if (m_uiFrenzy_Timer <= uiDiff) + { + DoCast(me, SPELL_FRENZY); + DoScriptText(EMOTE_GENERIC_FRENZY_KILL, me); + + m_uiFrenzy_Timer = 120000; + } + else + m_uiFrenzy_Timer -= uiDiff; + } + + DoMeleeAttackIfReady(); } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_theolenkrastinov(Creature* pCreature) -{ - return new boss_theolenkrastinovAI (pCreature); -} void AddSC_boss_theolenkrastinov() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_doctor_theolen_krastinov"; - newscript->GetAI = &GetAI_boss_theolenkrastinov; - newscript->RegisterSelf(); + new boss_doctor_theolen_krastinov(); } - diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_illucia_barov.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_illucia_barov.cpp index b2748fef22a..72991e3b59d 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/boss_illucia_barov.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_illucia_barov.cpp @@ -30,90 +30,92 @@ EndScriptData */ #define SPELL_SHADOWSHOCK 20603 #define SPELL_SILENCE 15487 #define SPELL_FEAR 6215 - -struct boss_illuciabarovAI : public ScriptedAI +
class boss_illucia_barov : public CreatureScript { - boss_illuciabarovAI(Creature *c) : ScriptedAI(c) {} - - uint32 CurseOfAgony_Timer; - uint32 ShadowShock_Timer; - uint32 Silence_Timer; - uint32 Fear_Timer; +public: + boss_illucia_barov() : CreatureScript("boss_illucia_barov") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - CurseOfAgony_Timer = 18000; - ShadowShock_Timer = 9000; - Silence_Timer = 5000; - Fear_Timer = 30000; + return new boss_illuciabarovAI (pCreature); } - void JustDied(Unit * /*killer*/) + struct boss_illuciabarovAI : public ScriptedAI { - ScriptedInstance *pInstance = me->GetInstanceData(); - if (pInstance) - { - pInstance->SetData(DATA_LADYILLUCIABAROV_DEATH, 0); + boss_illuciabarovAI(Creature *c) : ScriptedAI(c) {} - if (pInstance->GetData(TYPE_GANDLING) == IN_PROGRESS) - me->SummonCreature(1853, 180.73, -9.43856, 75.507, 1.61399, TEMPSUMMON_DEAD_DESPAWN, 0); - } - } + uint32 CurseOfAgony_Timer; + uint32 ShadowShock_Timer; + uint32 Silence_Timer; + uint32 Fear_Timer; - void EnterCombat(Unit * /*who*/) - { - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - //CurseOfAgony_Timer - if (CurseOfAgony_Timer <= diff) + void Reset() { - DoCast(me->getVictim(), SPELL_CURSEOFAGONY); - CurseOfAgony_Timer = 30000; - } else CurseOfAgony_Timer -= diff; + CurseOfAgony_Timer = 18000; + ShadowShock_Timer = 9000; + Silence_Timer = 5000; + Fear_Timer = 30000; + } - //ShadowShock_Timer - if (ShadowShock_Timer <= diff) + void JustDied(Unit * /*killer*/) { - Unit *pTarget = NULL; - pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); - if (pTarget) DoCast(pTarget, SPELL_SHADOWSHOCK); - - ShadowShock_Timer = 12000; - } else ShadowShock_Timer -= diff; + InstanceScript *pInstance = me->GetInstanceScript(); + if (pInstance) + { + pInstance->SetData(DATA_LADYILLUCIABAROV_DEATH, 0); + + if (pInstance->GetData(TYPE_GANDLING) == IN_PROGRESS) + me->SummonCreature(1853, 180.73, -9.43856, 75.507, 1.61399, TEMPSUMMON_DEAD_DESPAWN, 0); + } + } - //Silence_Timer - if (Silence_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - DoCast(me->getVictim(), SPELL_SILENCE); - Silence_Timer = 14000; - } else Silence_Timer -= diff; + } - //Fear_Timer - if (Fear_Timer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_FEAR); - Fear_Timer = 30000; - } else Fear_Timer -= diff; + if (!UpdateVictim()) + return; + + //CurseOfAgony_Timer + if (CurseOfAgony_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_CURSEOFAGONY); + CurseOfAgony_Timer = 30000; + } else CurseOfAgony_Timer -= diff; + + //ShadowShock_Timer + if (ShadowShock_Timer <= diff) + { + Unit *pTarget = NULL; + pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); + if (pTarget) DoCast(pTarget, SPELL_SHADOWSHOCK); + + ShadowShock_Timer = 12000; + } else ShadowShock_Timer -= diff; + + //Silence_Timer + if (Silence_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_SILENCE); + Silence_Timer = 14000; + } else Silence_Timer -= diff; + + //Fear_Timer + if (Fear_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_FEAR); + Fear_Timer = 30000; + } else Fear_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_illuciabarov(Creature* pCreature) -{ - return new boss_illuciabarovAI (pCreature); -} void AddSC_boss_illuciabarov() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_illucia_barov"; - newscript->GetAI = &GetAI_boss_illuciabarov; - newscript->RegisterSelf(); + new boss_illucia_barov(); } - diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_instructor_malicia.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_instructor_malicia.cpp index d78b486d00f..9c23fbb1087 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/boss_instructor_malicia.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_instructor_malicia.cpp @@ -31,125 +31,127 @@ EndScriptData */ #define SPELL_FLASHHEAL 10917 #define SPELL_RENEW 10929 #define SPELL_HEALINGTOUCH 9889 - -struct boss_instructormaliciaAI : public ScriptedAI +
class boss_instructor_malicia : public CreatureScript { - boss_instructormaliciaAI(Creature *c) : ScriptedAI(c) {} - - uint32 CallOfGraves_Timer; - uint32 Corruption_Timer; - uint32 FlashHeal_Timer; - uint32 Renew_Timer; - uint32 HealingTouch_Timer; - uint32 FlashCounter; - uint32 TouchCounter; +public: + boss_instructor_malicia() : CreatureScript("boss_instructor_malicia") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - CallOfGraves_Timer = 4000; - Corruption_Timer = 8000; - FlashHeal_Timer = 38000; - Renew_Timer = 32000; - HealingTouch_Timer = 45000; - FlashCounter = 0; - TouchCounter = 0; - } - - void JustDied(Unit * /*killer*/) - { - ScriptedInstance *pInstance = me->GetInstanceData(); - if (pInstance) - { - pInstance->SetData(DATA_INSTRUCTORMALICIA_DEATH, 0); - - if (pInstance->GetData(TYPE_GANDLING) == IN_PROGRESS) - me->SummonCreature(1853, 180.73, -9.43856, 75.507, 1.61399, TEMPSUMMON_DEAD_DESPAWN, 0); - } + return new boss_instructormaliciaAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_instructormaliciaAI : public ScriptedAI { - } + boss_instructormaliciaAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + uint32 CallOfGraves_Timer; + uint32 Corruption_Timer; + uint32 FlashHeal_Timer; + uint32 Renew_Timer; + uint32 HealingTouch_Timer; + uint32 FlashCounter; + uint32 TouchCounter; - //CallOfGraves_Timer - if (CallOfGraves_Timer <= diff) + void Reset() { - DoCast(me->getVictim(), SPELL_CALLOFGRAVES); - CallOfGraves_Timer = 65000; - } else CallOfGraves_Timer -= diff; + CallOfGraves_Timer = 4000; + Corruption_Timer = 8000; + FlashHeal_Timer = 38000; + Renew_Timer = 32000; + HealingTouch_Timer = 45000; + FlashCounter = 0; + TouchCounter = 0; + } - //Corruption_Timer - if (Corruption_Timer <= diff) + void JustDied(Unit * /*killer*/) { - Unit *pTarget = NULL; - pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); - if (pTarget) DoCast(pTarget, SPELL_CORRUPTION); + InstanceScript *pInstance = me->GetInstanceScript(); + if (pInstance) + { + pInstance->SetData(DATA_INSTRUCTORMALICIA_DEATH, 0); - Corruption_Timer = 24000; - } else Corruption_Timer -= diff; + if (pInstance->GetData(TYPE_GANDLING) == IN_PROGRESS) + me->SummonCreature(1853, 180.73, -9.43856, 75.507, 1.61399, TEMPSUMMON_DEAD_DESPAWN, 0); + } + } - //Renew_Timer - if (Renew_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - DoCast(me, SPELL_RENEW); - Renew_Timer = 10000; - } else Renew_Timer -= diff; + } - //FlashHeal_Timer - if (FlashHeal_Timer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me, SPELL_FLASHHEAL); + if (!UpdateVictim()) + return; - //5 Flashheals will be casted - if (FlashCounter < 2) + //CallOfGraves_Timer + if (CallOfGraves_Timer <= diff) { - FlashHeal_Timer = 5000; - ++FlashCounter; - } - else + DoCast(me->getVictim(), SPELL_CALLOFGRAVES); + CallOfGraves_Timer = 65000; + } else CallOfGraves_Timer -= diff; + + //Corruption_Timer + if (Corruption_Timer <= diff) { - FlashCounter=0; - FlashHeal_Timer = 30000; - } - } else FlashHeal_Timer -= diff; + Unit *pTarget = NULL; + pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); + if (pTarget) DoCast(pTarget, SPELL_CORRUPTION); - //HealingTouch_Timer - if (HealingTouch_Timer <= diff) - { - DoCast(me, SPELL_HEALINGTOUCH); + Corruption_Timer = 24000; + } else Corruption_Timer -= diff; - //3 Healingtouchs will be casted - if (HealingTouch_Timer < 2) + //Renew_Timer + if (Renew_Timer <= diff) { - HealingTouch_Timer = 5500; - ++TouchCounter; - } - else + DoCast(me, SPELL_RENEW); + Renew_Timer = 10000; + } else Renew_Timer -= diff; + + //FlashHeal_Timer + if (FlashHeal_Timer <= diff) { - TouchCounter=0; - HealingTouch_Timer = 30000; - } - } else HealingTouch_Timer -= diff; + DoCast(me, SPELL_FLASHHEAL); + + //5 Flashheals will be casted + if (FlashCounter < 2) + { + FlashHeal_Timer = 5000; + ++FlashCounter; + } + else + { + FlashCounter=0; + FlashHeal_Timer = 30000; + } + } else FlashHeal_Timer -= diff; + + //HealingTouch_Timer + if (HealingTouch_Timer <= diff) + { + DoCast(me, SPELL_HEALINGTOUCH); + + //3 Healingtouchs will be casted + if (HealingTouch_Timer < 2) + { + HealingTouch_Timer = 5500; + ++TouchCounter; + } + else + { + TouchCounter=0; + HealingTouch_Timer = 30000; + } + } else HealingTouch_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_instructormalicia(Creature* pCreature) -{ - return new boss_instructormaliciaAI (pCreature); -} void AddSC_boss_instructormalicia() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_instructor_malicia"; - newscript->GetAI = &GetAI_boss_instructormalicia; - newscript->RegisterSelf(); + new boss_instructor_malicia(); } - diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_jandice_barov.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_jandice_barov.cpp index 63ba5885573..316f78fd42b 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/boss_jandice_barov.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_jandice_barov.cpp @@ -30,174 +30,179 @@ EndScriptData */ //Spells of Illusion of Jandice Barov #define SPELL_CLEAVE 15584 - -struct boss_jandicebarovAI : public ScriptedAI +
class boss_jandice_barov : public CreatureScript { - boss_jandicebarovAI(Creature *c) : ScriptedAI(c) {} - - uint32 CurseOfBlood_Timer; - uint32 Illusion_Timer; - //uint32 Illusioncounter; - uint32 Invisible_Timer; - bool Invisible; +public: + boss_jandice_barov() : CreatureScript("boss_jandice_barov") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - CurseOfBlood_Timer = 15000; - Illusion_Timer = 30000; - Invisible_Timer = 3000; //Too much too low? - Invisible = false; + return new boss_jandicebarovAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_jandicebarovAI : public ScriptedAI { - } + boss_jandicebarovAI(Creature *c) : ScriptedAI(c) {} - void SummonIllusions(Unit* victim) - { - if (Creature *Illusion = DoSpawnCreature(11439, irand(-9,9), irand(-9,9), 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 60000)) - Illusion->AI()->AttackStart(victim); - } + uint32 CurseOfBlood_Timer; + uint32 Illusion_Timer; + //uint32 Illusioncounter; + 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); - me->SetDisplayId(11073); //Jandice Model + CurseOfBlood_Timer = 15000; + Illusion_Timer = 30000; + Invisible_Timer = 3000; //Too much too low? Invisible = false; - } else if (Invisible) + } + + void EnterCombat(Unit * /*who*/) { - Invisible_Timer -= diff; - //Do nothing while invisible - return; } - //Return since we have no target - if (!UpdateVictim()) - return; + void SummonIllusions(Unit* victim) + { + if (Creature *Illusion = DoSpawnCreature(11439, irand(-9,9), irand(-9,9), 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 60000)) + Illusion->AI()->AttackStart(victim); + } - //CurseOfBlood_Timer - if (CurseOfBlood_Timer <= diff) + void UpdateAI(const uint32 diff) { - //Cast - DoCast(me->getVictim(), SPELL_CURSEOFBLOOD); + if (Invisible && Invisible_Timer <= diff) + { + //Become visible again + me->setFaction(14); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetDisplayId(11073); //Jandice Model + Invisible = false; + } else if (Invisible) + { + Invisible_Timer -= diff; + //Do nothing while invisible + return; + } - //45 seconds - CurseOfBlood_Timer = 30000; - } else CurseOfBlood_Timer -= diff; + //Return since we have no target + if (!UpdateVictim()) + return; - //Illusion_Timer - if (!Invisible && Illusion_Timer <= diff) - { + //CurseOfBlood_Timer + if (CurseOfBlood_Timer <= diff) + { + //Cast + DoCast(me->getVictim(), SPELL_CURSEOFBLOOD); - //Interrupt any spell casting - me->InterruptNonMeleeSpells(false); - me->setFaction(35); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->SetDisplayId(11686); // Invisible Model - DoModifyThreatPercent(me->getVictim(),-99); + //45 seconds + CurseOfBlood_Timer = 30000; + } else CurseOfBlood_Timer -= diff; - //Summon 10 Illusions attacking random gamers - Unit *pTarget = NULL; - for (uint8 i = 0; i < 10; ++i) + //Illusion_Timer + if (!Invisible && Illusion_Timer <= diff) { - pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); - if (pTarget) - SummonIllusions(pTarget); - } - Invisible = true; - Invisible_Timer = 3000; - - //25 seconds until we should cast this agian - Illusion_Timer = 25000; - } else Illusion_Timer -= diff; - - // //Illusion_Timer - // if (Illusion_Timer <= diff) - // { - // //Cast - // DoCast(me->getVictim(), SPELL_ILLUSION); - // - // //3 Illusion will be summoned - // if (Illusioncounter < 3) - // { - // Illusion_Timer = 500; - // ++Illusioncounter; - // } - // else { - // //15 seconds until we should cast this again - // Illusion_Timer = 15000; - // Illusioncounter = 0; - // } - // - // } else Illusion_Timer -= diff; - - DoMeleeAttackIfReady(); - } + + //Interrupt any spell casting + me->InterruptNonMeleeSpells(false); + me->setFaction(35); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetDisplayId(11686); // Invisible Model + DoModifyThreatPercent(me->getVictim(),-99); + + //Summon 10 Illusions attacking random gamers + Unit *pTarget = NULL; + for (uint8 i = 0; i < 10; ++i) + { + pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); + if (pTarget) + SummonIllusions(pTarget); + } + Invisible = true; + Invisible_Timer = 3000; + + //25 seconds until we should cast this agian + Illusion_Timer = 25000; + } else Illusion_Timer -= diff; + + // //Illusion_Timer + // if (Illusion_Timer <= diff) + // { + // //Cast + // DoCast(me->getVictim(), SPELL_ILLUSION); + // + // //3 Illusion will be summoned + // if (Illusioncounter < 3) + // { + // Illusion_Timer = 500; + // ++Illusioncounter; + // } + // else { + // //15 seconds until we should cast this again + // Illusion_Timer = 15000; + // Illusioncounter = 0; + // } + // + // } else Illusion_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; + }; // Illusion of Jandice Barov Script - -struct mob_illusionofjandicebarovAI : public ScriptedAI +
class mob_illusionofjandicebarov : public CreatureScript { - mob_illusionofjandicebarovAI(Creature *c) : ScriptedAI(c) {} - - uint32 Cleave_Timer; +public: + mob_illusionofjandicebarov() : CreatureScript("mob_illusionofjandicebarov") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - Cleave_Timer = 2000 + rand()%6000; - me->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_MAGIC, true); + return new mob_illusionofjandicebarovAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct mob_illusionofjandicebarovAI : public ScriptedAI { - } + mob_illusionofjandicebarovAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + uint32 Cleave_Timer; + + void Reset() + { + Cleave_Timer = 2000 + rand()%6000; + me->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_MAGIC, true); + } - //Cleave_Timer - if (Cleave_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - //Cast - DoCast(me->getVictim(), SPELL_CLEAVE); + } - //5-8 seconds - Cleave_Timer = 5000 + rand()%3000; - } else Cleave_Timer -= diff; + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + //Cleave_Timer + if (Cleave_Timer <= diff) + { + //Cast + DoCast(me->getVictim(), SPELL_CLEAVE); + + //5-8 seconds + Cleave_Timer = 5000 + rand()%3000; + } else Cleave_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_jandicebarov(Creature* pCreature) -{ - return new boss_jandicebarovAI (pCreature); -} -CreatureAI* GetAI_mob_illusionofjandicebarov(Creature* pCreature) -{ - return new mob_illusionofjandicebarovAI (pCreature); -} void AddSC_boss_jandicebarov() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_jandice_barov"; - newscript->GetAI = &GetAI_boss_jandicebarov; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_illusionofjandicebarov"; - newscript->GetAI = &GetAI_mob_illusionofjandicebarov; - newscript->RegisterSelf(); + new boss_jandice_barov(); + new mob_illusionofjandicebarov(); } - diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_kormok.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_kormok.cpp index 9a41a16a2e7..5518e04aa5e 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/boss_kormok.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_kormok.cpp @@ -27,96 +27,98 @@ EndScriptData */ #define SPELL_SHADOWBOLTVOLLEY 20741 #define SPELL_BONESHIELD 27688 - -struct boss_kormokAI : public ScriptedAI +
class boss_kormok : public CreatureScript { - boss_kormokAI(Creature *c) : ScriptedAI(c) {} - - uint32 ShadowVolley_Timer; - uint32 BoneShield_Timer; - uint32 Minion_Timer; - uint32 Mage_Timer; - bool Mages; - - void Reset() - { - ShadowVolley_Timer = 10000; - BoneShield_Timer = 2000; - Minion_Timer = 15000; - Mage_Timer = 0; - Mages = false; - } +public: + boss_kormok() : CreatureScript("boss_kormok") { } - void EnterCombat(Unit * /*who*/) + CreatureAI* GetAI(Creature* pCreature) const { + return new boss_kormokAI (pCreature); } - void SummonMinions(Unit* victim) + struct boss_kormokAI : public ScriptedAI { - if (Creature *SummonedMinion = DoSpawnCreature(16119, irand(-7,7), irand(-7,7), 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 120000)) - SummonedMinion->AI()->AttackStart(victim); - } + boss_kormokAI(Creature *c) : ScriptedAI(c) {} - void SummonMages(Unit* victim) - { - if (Creature *SummonedMage = DoSpawnCreature(16120, irand(-9,9), irand(-9,9), 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 120000)) - SummonedMage->AI()->AttackStart(victim); - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + uint32 ShadowVolley_Timer; + uint32 BoneShield_Timer; + uint32 Minion_Timer; + uint32 Mage_Timer; + bool Mages; - //ShadowVolley_Timer - if (ShadowVolley_Timer <= diff) + void Reset() { - DoCast(me->getVictim(), SPELL_SHADOWBOLTVOLLEY); - ShadowVolley_Timer = 15000; - } else ShadowVolley_Timer -= diff; + ShadowVolley_Timer = 10000; + BoneShield_Timer = 2000; + Minion_Timer = 15000; + Mage_Timer = 0; + Mages = false; + } - //BoneShield_Timer - if (BoneShield_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - DoCast(me->getVictim(), SPELL_BONESHIELD); - BoneShield_Timer = 45000; - } else BoneShield_Timer -= diff; + } - //Minion_Timer - if (Minion_Timer <= diff) + void SummonMinions(Unit* victim) { - //Cast - SummonMinions(me->getVictim()); - SummonMinions(me->getVictim()); - SummonMinions(me->getVictim()); - SummonMinions(me->getVictim()); + if (Creature *SummonedMinion = DoSpawnCreature(16119, irand(-7,7), irand(-7,7), 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 120000)) + SummonedMinion->AI()->AttackStart(victim); + } - Minion_Timer = 12000; - } else Minion_Timer -= diff; + void SummonMages(Unit* victim) + { + if (Creature *SummonedMage = DoSpawnCreature(16120, irand(-9,9), irand(-9,9), 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 120000)) + SummonedMage->AI()->AttackStart(victim); + } - //Summon 2 Bone Mages - if (!Mages && me->GetHealth()*100 / me->GetMaxHealth() < 26) + void UpdateAI(const uint32 diff) { - //Cast - SummonMages(me->getVictim()); - SummonMages(me->getVictim()); - Mages = true; + if (!UpdateVictim()) + return; + + //ShadowVolley_Timer + if (ShadowVolley_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_SHADOWBOLTVOLLEY); + ShadowVolley_Timer = 15000; + } else ShadowVolley_Timer -= diff; + + //BoneShield_Timer + if (BoneShield_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_BONESHIELD); + BoneShield_Timer = 45000; + } else BoneShield_Timer -= diff; + + //Minion_Timer + if (Minion_Timer <= diff) + { + //Cast + SummonMinions(me->getVictim()); + SummonMinions(me->getVictim()); + SummonMinions(me->getVictim()); + SummonMinions(me->getVictim()); + + Minion_Timer = 12000; + } else Minion_Timer -= diff; + + //Summon 2 Bone Mages + if (!Mages && me->GetHealth()*100 / me->GetMaxHealth() < 26) + { + //Cast + SummonMages(me->getVictim()); + SummonMages(me->getVictim()); + Mages = true; + } + + DoMeleeAttackIfReady(); } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_kormok(Creature* pCreature) -{ - return new boss_kormokAI (pCreature); -} void AddSC_boss_kormok() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_kormok"; - newscript->GetAI = &GetAI_boss_kormok; - newscript->RegisterSelf(); + new boss_kormok(); } - diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_lord_alexei_barov.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_lord_alexei_barov.cpp index 9782475540f..9878711b7c1 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/boss_lord_alexei_barov.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_lord_alexei_barov.cpp @@ -28,74 +28,76 @@ EndScriptData */ #define SPELL_IMMOLATE 20294 // Old ID was 15570 #define SPELL_VEILOFSHADOW 17820 - -struct boss_lordalexeibarovAI : public ScriptedAI +
class boss_lord_alexei_barov : public CreatureScript { - boss_lordalexeibarovAI(Creature *c) : ScriptedAI(c) {} - - uint32 Immolate_Timer; - uint32 VeilofShadow_Timer; +public: + boss_lord_alexei_barov() : CreatureScript("boss_lord_alexei_barov") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - Immolate_Timer = 7000; - VeilofShadow_Timer = 15000; - - me->LoadCreaturesAddon(); + return new boss_lordalexeibarovAI (pCreature); } - void JustDied(Unit * /*killer*/) + struct boss_lordalexeibarovAI : public ScriptedAI { - ScriptedInstance *pInstance = me->GetInstanceData(); - if (pInstance) - { - pInstance->SetData(DATA_LORDALEXEIBAROV_DEATH, 0); + boss_lordalexeibarovAI(Creature *c) : ScriptedAI(c) {} - if (pInstance->GetData(TYPE_GANDLING) == IN_PROGRESS) - me->SummonCreature(1853, 180.73, -9.43856, 75.507, 1.61399, TEMPSUMMON_DEAD_DESPAWN, 0); - } - } + uint32 Immolate_Timer; + uint32 VeilofShadow_Timer; - void EnterCombat(Unit * /*who*/) - { - } + void Reset() + { + Immolate_Timer = 7000; + VeilofShadow_Timer = 15000; - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + me->LoadCreaturesAddon(); + } - //Immolate_Timer - if (Immolate_Timer <= diff) + void JustDied(Unit * /*killer*/) { - Unit *pTarget = NULL; - pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); - if (pTarget) DoCast(pTarget, SPELL_IMMOLATE); + InstanceScript *pInstance = me->GetInstanceScript(); + if (pInstance) + { + pInstance->SetData(DATA_LORDALEXEIBAROV_DEATH, 0); + + if (pInstance->GetData(TYPE_GANDLING) == IN_PROGRESS) + me->SummonCreature(1853, 180.73, -9.43856, 75.507, 1.61399, TEMPSUMMON_DEAD_DESPAWN, 0); + } + } - Immolate_Timer = 12000; - } else Immolate_Timer -= diff; + void EnterCombat(Unit * /*who*/) + { + } - //VeilofShadow_Timer - if (VeilofShadow_Timer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_VEILOFSHADOW); - VeilofShadow_Timer = 20000; - } else VeilofShadow_Timer -= diff; + if (!UpdateVictim()) + return; + + //Immolate_Timer + if (Immolate_Timer <= diff) + { + Unit *pTarget = NULL; + pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); + if (pTarget) DoCast(pTarget, SPELL_IMMOLATE); + + Immolate_Timer = 12000; + } else Immolate_Timer -= diff; + + //VeilofShadow_Timer + if (VeilofShadow_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_VEILOFSHADOW); + VeilofShadow_Timer = 20000; + } else VeilofShadow_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_lordalexeibarov(Creature* pCreature) -{ - return new boss_lordalexeibarovAI (pCreature); -} void AddSC_boss_lordalexeibarov() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_lord_alexei_barov"; - newscript->GetAI = &GetAI_boss_lordalexeibarov; - newscript->RegisterSelf(); + new boss_lord_alexei_barov(); } - diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_lorekeeper_polkelt.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_lorekeeper_polkelt.cpp index 7d3dc7cf873..ad975112e07 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/boss_lorekeeper_polkelt.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_lorekeeper_polkelt.cpp @@ -30,87 +30,89 @@ EndScriptData */ #define SPELL_DARKPLAGUE 18270 #define SPELL_CORROSIVEACID 23313 #define SPELL_NOXIOUSCATALYST 18151 - -struct boss_lorekeeperpolkeltAI : public ScriptedAI +
class boss_lorekeeper_polkelt : public CreatureScript { - boss_lorekeeperpolkeltAI(Creature *c) : ScriptedAI(c) {} - - uint32 VolatileInfection_Timer; - uint32 Darkplague_Timer; - uint32 CorrosiveAcid_Timer; - uint32 NoxiousCatalyst_Timer; - - void Reset() - { - VolatileInfection_Timer = 38000; - Darkplague_Timer = 8000; - CorrosiveAcid_Timer = 45000; - NoxiousCatalyst_Timer = 35000; - } +public: + boss_lorekeeper_polkelt() : CreatureScript("boss_lorekeeper_polkelt") { } - void JustDied(Unit * /*killer*/) + CreatureAI* GetAI(Creature* pCreature) const { - ScriptedInstance *pInstance = me->GetInstanceData(); - if (pInstance) - { - pInstance->SetData(DATA_LOREKEEPERPOLKELT_DEATH, 0); - - if (pInstance->GetData(TYPE_GANDLING) == IN_PROGRESS) - me->SummonCreature(1853, 180.73, -9.43856, 75.507, 1.61399, TEMPSUMMON_DEAD_DESPAWN, 0); - } + return new boss_lorekeeperpolkeltAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_lorekeeperpolkeltAI : public ScriptedAI { - } + boss_lorekeeperpolkeltAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + uint32 VolatileInfection_Timer; + uint32 Darkplague_Timer; + uint32 CorrosiveAcid_Timer; + uint32 NoxiousCatalyst_Timer; - //VolatileInfection_Timer - if (VolatileInfection_Timer <= diff) + void Reset() { - DoCast(me->getVictim(), SPELL_VOLATILEINFECTION); - VolatileInfection_Timer = 32000; - } else VolatileInfection_Timer -= diff; + VolatileInfection_Timer = 38000; + Darkplague_Timer = 8000; + CorrosiveAcid_Timer = 45000; + NoxiousCatalyst_Timer = 35000; + } - //Darkplague_Timer - if (Darkplague_Timer <= diff) + void JustDied(Unit * /*killer*/) { - DoCast(me->getVictim(), SPELL_DARKPLAGUE); - Darkplague_Timer = 8000; - } else Darkplague_Timer -= diff; + InstanceScript *pInstance = me->GetInstanceScript(); + if (pInstance) + { + pInstance->SetData(DATA_LOREKEEPERPOLKELT_DEATH, 0); + + if (pInstance->GetData(TYPE_GANDLING) == IN_PROGRESS) + me->SummonCreature(1853, 180.73, -9.43856, 75.507, 1.61399, TEMPSUMMON_DEAD_DESPAWN, 0); + } + } - //CorrosiveAcid_Timer - if (CorrosiveAcid_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - DoCast(me->getVictim(), SPELL_CORROSIVEACID); - CorrosiveAcid_Timer = 25000; - } else CorrosiveAcid_Timer -= diff; + } - //NoxiousCatalyst_Timer - if (NoxiousCatalyst_Timer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_NOXIOUSCATALYST); - NoxiousCatalyst_Timer = 38000; - } else NoxiousCatalyst_Timer -= diff; + if (!UpdateVictim()) + return; + + //VolatileInfection_Timer + if (VolatileInfection_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_VOLATILEINFECTION); + VolatileInfection_Timer = 32000; + } else VolatileInfection_Timer -= diff; + + //Darkplague_Timer + if (Darkplague_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_DARKPLAGUE); + Darkplague_Timer = 8000; + } else Darkplague_Timer -= diff; + + //CorrosiveAcid_Timer + if (CorrosiveAcid_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_CORROSIVEACID); + CorrosiveAcid_Timer = 25000; + } else CorrosiveAcid_Timer -= diff; + + //NoxiousCatalyst_Timer + if (NoxiousCatalyst_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_NOXIOUSCATALYST); + NoxiousCatalyst_Timer = 38000; + } else NoxiousCatalyst_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_lorekeeperpolkelt(Creature* pCreature) -{ - return new boss_lorekeeperpolkeltAI (pCreature); -} void AddSC_boss_lorekeeperpolkelt() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_lorekeeper_polkelt"; - newscript->GetAI = &GetAI_boss_lorekeeperpolkelt; - newscript->RegisterSelf(); + new boss_lorekeeper_polkelt(); } - diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_ras_frostwhisper.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_ras_frostwhisper.cpp index a5957995981..0cdcbaf04ad 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/boss_ras_frostwhisper.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_ras_frostwhisper.cpp @@ -31,95 +31,97 @@ EndScriptData */ #define SPELL_FEAR 26070 #define SPELL_CHILLNOVA 18099 #define SPELL_FROSTVOLLEY 8398 - -struct boss_rasfrostAI : public ScriptedAI +
class boss_boss_ras_frostwhisper : public CreatureScript { - boss_rasfrostAI(Creature *c) : ScriptedAI(c) {} - - uint32 IceArmor_Timer; - uint32 Frostbolt_Timer; - uint32 Freeze_Timer; - uint32 Fear_Timer; - uint32 ChillNova_Timer; - uint32 FrostVolley_Timer; +public: + boss_boss_ras_frostwhisper() : CreatureScript("boss_boss_ras_frostwhisper") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - IceArmor_Timer = 2000; - Frostbolt_Timer = 8000; - ChillNova_Timer = 12000; - Freeze_Timer = 18000; - FrostVolley_Timer = 24000; - Fear_Timer = 45000; - - DoCast(me, SPELL_ICEARMOR, true); + return new boss_rasfrostAI (pCreature); } - void EnterCombat(Unit * /*who*/){} - - void UpdateAI(const uint32 diff) + struct boss_rasfrostAI : public ScriptedAI { - if (!UpdateVictim()) - return; + boss_rasfrostAI(Creature *c) : ScriptedAI(c) {} - //IceArmor_Timer - if (IceArmor_Timer <= diff) - { - DoCast(me, SPELL_ICEARMOR); - IceArmor_Timer = 180000; - } else IceArmor_Timer -= diff; + uint32 IceArmor_Timer; + uint32 Frostbolt_Timer; + uint32 Freeze_Timer; + uint32 Fear_Timer; + uint32 ChillNova_Timer; + uint32 FrostVolley_Timer; - //Frostbolt_Timer - if (Frostbolt_Timer <= diff) + void Reset() { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(pTarget, SPELL_FROSTBOLT); - + IceArmor_Timer = 2000; Frostbolt_Timer = 8000; - } else Frostbolt_Timer -= diff; + ChillNova_Timer = 12000; + Freeze_Timer = 18000; + FrostVolley_Timer = 24000; + Fear_Timer = 45000; - //Freeze_Timer - if (Freeze_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_FREEZE); - Freeze_Timer = 24000; - } else Freeze_Timer -= diff; + DoCast(me, SPELL_ICEARMOR, true); + } - //Fear_Timer - if (Fear_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_FEAR); - Fear_Timer = 30000; - } else Fear_Timer -= diff; + void EnterCombat(Unit * /*who*/){} - //ChillNova_Timer - if (ChillNova_Timer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_CHILLNOVA); - ChillNova_Timer = 14000; - } else ChillNova_Timer -= diff; + if (!UpdateVictim()) + return; + + //IceArmor_Timer + if (IceArmor_Timer <= diff) + { + DoCast(me, SPELL_ICEARMOR); + IceArmor_Timer = 180000; + } else IceArmor_Timer -= diff; + + //Frostbolt_Timer + if (Frostbolt_Timer <= diff) + { + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + DoCast(pTarget, SPELL_FROSTBOLT); + + Frostbolt_Timer = 8000; + } else Frostbolt_Timer -= diff; + + //Freeze_Timer + if (Freeze_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_FREEZE); + Freeze_Timer = 24000; + } else Freeze_Timer -= diff; + + //Fear_Timer + if (Fear_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_FEAR); + Fear_Timer = 30000; + } else Fear_Timer -= diff; + + //ChillNova_Timer + if (ChillNova_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_CHILLNOVA); + ChillNova_Timer = 14000; + } else ChillNova_Timer -= diff; + + //FrostVolley_Timer + if (FrostVolley_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_FROSTVOLLEY); + FrostVolley_Timer = 15000; + } else FrostVolley_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - //FrostVolley_Timer - if (FrostVolley_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_FROSTVOLLEY); - FrostVolley_Timer = 15000; - } else FrostVolley_Timer -= diff; - - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_rasfrost(Creature* pCreature) -{ - return new boss_rasfrostAI (pCreature); -} void AddSC_boss_rasfrost() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_boss_ras_frostwhisper"; - newscript->GetAI = &GetAI_boss_rasfrost; - newscript->RegisterSelf(); + new boss_boss_ras_frostwhisper(); } - diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_the_ravenian.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_the_ravenian.cpp index e23bc4fdd97..d50e3752e32 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/boss_the_ravenian.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_the_ravenian.cpp @@ -30,90 +30,92 @@ EndScriptData */ #define SPELL_CLEAVE 20691 #define SPELL_SUNDERINCLEAVE 25174 #define SPELL_KNOCKAWAY 10101 - -struct boss_theravenianAI : public ScriptedAI +
class boss_the_ravenian : public CreatureScript { - boss_theravenianAI(Creature *c) : ScriptedAI(c) {} - - uint32 Trample_Timer; - uint32 Cleave_Timer; - uint32 SunderingCleave_Timer; - uint32 KnockAway_Timer; - bool HasYelled; +public: + boss_the_ravenian() : CreatureScript("boss_the_ravenian") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - Trample_Timer = 24000; - Cleave_Timer = 15000; - SunderingCleave_Timer = 40000; - KnockAway_Timer = 32000; - HasYelled = false; + return new boss_theravenianAI (pCreature); } - void JustDied(Unit * /*killer*/) + struct boss_theravenianAI : public ScriptedAI { - ScriptedInstance *pInstance = me->GetInstanceData(); - if (pInstance) - { - pInstance->SetData(DATA_THERAVENIAN_DEATH, 0); - - if (pInstance->GetData(TYPE_GANDLING) == IN_PROGRESS) - me->SummonCreature(1853, 180.73, -9.43856, 75.507, 1.61399, TEMPSUMMON_DEAD_DESPAWN, 0); - } - } - - void EnterCombat(Unit * /*who*/) - { - } + boss_theravenianAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + uint32 Trample_Timer; + uint32 Cleave_Timer; + uint32 SunderingCleave_Timer; + uint32 KnockAway_Timer; + bool HasYelled; - //Trample_Timer - if (Trample_Timer <= diff) + void Reset() { - DoCast(me->getVictim(), SPELL_TRAMPLE); - Trample_Timer = 10000; - } else Trample_Timer -= diff; + Trample_Timer = 24000; + Cleave_Timer = 15000; + SunderingCleave_Timer = 40000; + KnockAway_Timer = 32000; + HasYelled = false; + } - //Cleave_Timer - if (Cleave_Timer <= diff) + void JustDied(Unit * /*killer*/) { - DoCast(me->getVictim(), SPELL_CLEAVE); - Cleave_Timer = 7000; - } else Cleave_Timer -= diff; + InstanceScript *pInstance = me->GetInstanceScript(); + if (pInstance) + { + pInstance->SetData(DATA_THERAVENIAN_DEATH, 0); + + if (pInstance->GetData(TYPE_GANDLING) == IN_PROGRESS) + me->SummonCreature(1853, 180.73, -9.43856, 75.507, 1.61399, TEMPSUMMON_DEAD_DESPAWN, 0); + } + } - //SunderingCleave_Timer - if (SunderingCleave_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - DoCast(me->getVictim(), SPELL_SUNDERINCLEAVE); - SunderingCleave_Timer = 20000; - } else SunderingCleave_Timer -= diff; + } - //KnockAway_Timer - if (KnockAway_Timer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_KNOCKAWAY); - KnockAway_Timer = 12000; - } else KnockAway_Timer -= diff; + if (!UpdateVictim()) + return; + + //Trample_Timer + if (Trample_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_TRAMPLE); + Trample_Timer = 10000; + } else Trample_Timer -= diff; + + //Cleave_Timer + if (Cleave_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_CLEAVE); + Cleave_Timer = 7000; + } else Cleave_Timer -= diff; + + //SunderingCleave_Timer + if (SunderingCleave_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_SUNDERINCLEAVE); + SunderingCleave_Timer = 20000; + } else SunderingCleave_Timer -= diff; + + //KnockAway_Timer + if (KnockAway_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_KNOCKAWAY); + KnockAway_Timer = 12000; + } else KnockAway_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_theravenian(Creature* pCreature) -{ - return new boss_theravenianAI (pCreature); -} void AddSC_boss_theravenian() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_the_ravenian"; - newscript->GetAI = &GetAI_boss_theravenian; - newscript->RegisterSelf(); + new boss_the_ravenian(); } - diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_vectus.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_vectus.cpp index 1aa278f1bce..e4b89896dac 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/boss_vectus.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_vectus.cpp @@ -34,74 +34,76 @@ enum eEnums SPELL_FIRESHIELD = 19626, SPELL_FRENZY = 8269 //28371, }; - -struct boss_vectusAI : public ScriptedAI +
class boss_vectus : public CreatureScript { - boss_vectusAI(Creature *c) : ScriptedAI(c) {} - - uint32 m_uiFireShield_Timer; - uint32 m_uiBlastWave_Timer; - uint32 m_uiFrenzy_Timer; +public: + boss_vectus() : CreatureScript("boss_vectus") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - m_uiFireShield_Timer = 2000; - m_uiBlastWave_Timer = 14000; - m_uiFrenzy_Timer = 0; + return new boss_vectusAI (pCreature); } - void UpdateAI(const uint32 uiDiff) + struct boss_vectusAI : public ScriptedAI { - if (!UpdateVictim()) - return; + boss_vectusAI(Creature *c) : ScriptedAI(c) {} - //FireShield_Timer - if (m_uiFireShield_Timer <= uiDiff) - { - DoCast(me, SPELL_FIRESHIELD); - m_uiFireShield_Timer = 90000; - } - else - m_uiFireShield_Timer -= uiDiff; + uint32 m_uiFireShield_Timer; + uint32 m_uiBlastWave_Timer; + uint32 m_uiFrenzy_Timer; - //BlastWave_Timer - if (m_uiBlastWave_Timer <= uiDiff) + void Reset() { - DoCast(me->getVictim(), SPELL_BLAST_WAVE); - m_uiBlastWave_Timer = 12000; + m_uiFireShield_Timer = 2000; + m_uiBlastWave_Timer = 14000; + m_uiFrenzy_Timer = 0; } - else - m_uiBlastWave_Timer -= uiDiff; - //Frenzy_Timer - if (me->GetHealth()*100 / me->GetMaxHealth() < 25) + void UpdateAI(const uint32 uiDiff) { - if (m_uiFrenzy_Timer <= uiDiff) + if (!UpdateVictim()) + return; + + //FireShield_Timer + if (m_uiFireShield_Timer <= uiDiff) { - DoCast(me, SPELL_FRENZY); - DoScriptText(EMOTE_GENERIC_FRENZY_KILL, me); + DoCast(me, SPELL_FIRESHIELD); + m_uiFireShield_Timer = 90000; + } + else + m_uiFireShield_Timer -= uiDiff; - m_uiFrenzy_Timer = 24000; + //BlastWave_Timer + if (m_uiBlastWave_Timer <= uiDiff) + { + DoCast(me->getVictim(), SPELL_BLAST_WAVE); + m_uiBlastWave_Timer = 12000; } else - m_uiFrenzy_Timer -= uiDiff; + m_uiBlastWave_Timer -= uiDiff; + + //Frenzy_Timer + if (me->GetHealth()*100 / me->GetMaxHealth() < 25) + { + if (m_uiFrenzy_Timer <= uiDiff) + { + DoCast(me, SPELL_FRENZY); + DoScriptText(EMOTE_GENERIC_FRENZY_KILL, me); + + m_uiFrenzy_Timer = 24000; + } + else + m_uiFrenzy_Timer -= uiDiff; + } + + DoMeleeAttackIfReady(); } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_vectus(Creature* pCreature) -{ - return new boss_vectusAI (pCreature); -} void AddSC_boss_vectus() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_vectus"; - newscript->GetAI = &GetAI_boss_vectus; - newscript->RegisterSelf(); + new boss_vectus(); } - diff --git a/src/server/scripts/EasternKingdoms/Scholomance/instance_scholomance.cpp b/src/server/scripts/EasternKingdoms/Scholomance/instance_scholomance.cpp index 28ed326cefa..898dd0f1a62 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/instance_scholomance.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/instance_scholomance.cpp @@ -36,113 +36,115 @@ EndScriptData */ #define GO_GATE_ILLUCIA 177371 #define MAX_ENCOUNTER 2 - -struct instance_scholomance : public ScriptedInstance +
class instance_scholomance : public InstanceMapScript { - instance_scholomance(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; - - //Lord Alexei Barov, Doctor Theolen Krastinov, The Ravenian, Lorekeeper Polkelt, Instructor Malicia and the Lady Illucia Barov. - bool IsBossDied[6]; - uint32 m_auiEncounter[MAX_ENCOUNTER]; - - uint64 GateKirtonosGUID; - uint64 GateGandlingGUID; - uint64 GateMiliciaGUID; - uint64 GateTheolenGUID; - uint64 GatePolkeltGUID; - uint64 GateRavenianGUID; - uint64 GateBarovGUID; - uint64 GateIlluciaGUID; - - void Initialize() +public: + instance_scholomance() : InstanceMapScript("instance_scholomance") { } + + InstanceScript* GetInstanceData_InstanceMapScript(Map* pMap) { - memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - - GateKirtonosGUID = 0; - GateGandlingGUID = 0; - GateMiliciaGUID = 0; - GateTheolenGUID = 0; - GatePolkeltGUID = 0; - GateRavenianGUID = 0; - GateBarovGUID = 0; - GateIlluciaGUID = 0; - - for (uint8 i = 0; i < 6; ++i) - IsBossDied[i] = false; + return new instance_scholomance_InstanceMapScript(pMap); } - void OnGameObjectCreate(GameObject* pGo, bool /*add*/) + struct instance_scholomance_InstanceMapScript : public InstanceScript { - switch(pGo->GetEntry()) + instance_scholomance_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {Initialize();}; + + //Lord Alexei Barov, Doctor Theolen Krastinov, The Ravenian, Lorekeeper Polkelt, Instructor Malicia and the Lady Illucia Barov. + bool IsBossDied[6]; + uint32 m_auiEncounter[MAX_ENCOUNTER]; + + uint64 GateKirtonosGUID; + uint64 GateGandlingGUID; + uint64 GateMiliciaGUID; + uint64 GateTheolenGUID; + uint64 GatePolkeltGUID; + uint64 GateRavenianGUID; + uint64 GateBarovGUID; + uint64 GateIlluciaGUID; + + void Initialize() { - case GO_GATE_KIRTONOS: GateKirtonosGUID = pGo->GetGUID(); break; - case GO_GATE_GANDLING: GateGandlingGUID = pGo->GetGUID(); break; - case GO_GATE_MALICIA: GateMiliciaGUID = pGo->GetGUID(); break; - case GO_GATE_THEOLEN: GateTheolenGUID = pGo->GetGUID(); break; - case GO_GATE_POLKELT: GatePolkeltGUID = pGo->GetGUID(); break; - case GO_GATE_RAVENIAN: GateRavenianGUID = pGo->GetGUID(); break; - case GO_GATE_BAROV: GateBarovGUID = pGo->GetGUID(); break; - case GO_GATE_ILLUCIA: GateIlluciaGUID = pGo->GetGUID(); break; + memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); + + GateKirtonosGUID = 0; + GateGandlingGUID = 0; + GateMiliciaGUID = 0; + GateTheolenGUID = 0; + GatePolkeltGUID = 0; + GateRavenianGUID = 0; + GateBarovGUID = 0; + GateIlluciaGUID = 0; + + for (uint8 i = 0; i < 6; ++i) + IsBossDied[i] = false; } - } - void SetData(uint32 type, uint32 data) - { - switch(type) + void OnGameObjectCreate(GameObject* pGo, bool /*add*/) { - case DATA_LORDALEXEIBAROV_DEATH: - IsBossDied[0] = true; - break; - case DATA_DOCTORTHEOLENKRASTINOV_DEATH: - IsBossDied[1] = true; - break; - case DATA_THERAVENIAN_DEATH: - IsBossDied[2] = true; - break; - case DATA_LOREKEEPERPOLKELT_DEATH: - IsBossDied[3] = true; - break; - case DATA_INSTRUCTORMALICIA_DEATH: - IsBossDied[4] = true; - break; - case DATA_LADYILLUCIABAROV_DEATH: - IsBossDied[5] = true; - break; - case TYPE_GANDLING: - m_auiEncounter[0] = data; - break; - case TYPE_KIRTONOS: - m_auiEncounter[1] = data; - break; + switch(pGo->GetEntry()) + { + case GO_GATE_KIRTONOS: GateKirtonosGUID = pGo->GetGUID(); break; + case GO_GATE_GANDLING: GateGandlingGUID = pGo->GetGUID(); break; + case GO_GATE_MALICIA: GateMiliciaGUID = pGo->GetGUID(); break; + case GO_GATE_THEOLEN: GateTheolenGUID = pGo->GetGUID(); break; + case GO_GATE_POLKELT: GatePolkeltGUID = pGo->GetGUID(); break; + case GO_GATE_RAVENIAN: GateRavenianGUID = pGo->GetGUID(); break; + case GO_GATE_BAROV: GateBarovGUID = pGo->GetGUID(); break; + case GO_GATE_ILLUCIA: GateIlluciaGUID = pGo->GetGUID(); break; + } } - } - uint32 GetData(uint32 type) - { - if (type == TYPE_GANDLING) + void SetData(uint32 type, uint32 data) { - if (IsBossDied[0] && IsBossDied[1] && IsBossDied[2] && IsBossDied[3] && IsBossDied[4] && IsBossDied[5]) + switch(type) { - m_auiEncounter[0] = IN_PROGRESS; - return IN_PROGRESS; + case DATA_LORDALEXEIBAROV_DEATH: + IsBossDied[0] = true; + break; + case DATA_DOCTORTHEOLENKRASTINOV_DEATH: + IsBossDied[1] = true; + break; + case DATA_THERAVENIAN_DEATH: + IsBossDied[2] = true; + break; + case DATA_LOREKEEPERPOLKELT_DEATH: + IsBossDied[3] = true; + break; + case DATA_INSTRUCTORMALICIA_DEATH: + IsBossDied[4] = true; + break; + case DATA_LADYILLUCIABAROV_DEATH: + IsBossDied[5] = true; + break; + case TYPE_GANDLING: + m_auiEncounter[0] = data; + break; + case TYPE_KIRTONOS: + m_auiEncounter[1] = data; + break; } } - return 0; - } + uint32 GetData(uint32 type) + { + if (type == TYPE_GANDLING) + { + if (IsBossDied[0] && IsBossDied[1] && IsBossDied[2] && IsBossDied[3] && IsBossDied[4] && IsBossDied[5]) + { + m_auiEncounter[0] = IN_PROGRESS; + return IN_PROGRESS; + } + } + + return 0; + } + }; + }; -InstanceData* GetInstanceData_instance_scholomance(Map* pMap) -{ - return new instance_scholomance(pMap); -} void AddSC_instance_scholomance() { - Script *newscript; - newscript = new Script; - newscript->Name = "instance_scholomance"; - newscript->GetInstanceData = &GetInstanceData_instance_scholomance; - newscript->RegisterSelf(); + new instance_scholomance(); } - diff --git a/src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp b/src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp index be3cd67c8d6..e8c7e83dd0c 100644 --- a/src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp +++ b/src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp @@ -53,227 +53,229 @@ const Position SpawnLocation[] = {-145.905,2180.520,128.448,4.183}, {-140.794,2178.037,128.448,4.090}, {-138.640,2170.159,136.577,2.737} -}; -struct instance_shadowfang_keep : public ScriptedInstance +};
class instance_shadowfang_keep : public InstanceMapScript { - instance_shadowfang_keep(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; +public: + instance_shadowfang_keep() : InstanceMapScript("instance_shadowfang_keep") { } + + InstanceScript* GetInstanceData_InstanceMapScript(Map* pMap) + { + return new instance_shadowfang_keep_InstanceMapScript(pMap); + } - uint32 m_auiEncounter[MAX_ENCOUNTER]; - std::string str_data; + struct instance_shadowfang_keep_InstanceMapScript : public InstanceScript + { + instance_shadowfang_keep_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {Initialize();}; - uint64 uiAshGUID; - uint64 uiAdaGUID; - uint64 uiArchmageArugalGUID; + uint32 m_auiEncounter[MAX_ENCOUNTER]; + std::string str_data; - uint64 DoorCourtyardGUID; - uint64 DoorSorcererGUID; - uint64 DoorArugalGUID; + uint64 uiAshGUID; + uint64 uiAdaGUID; + uint64 uiArchmageArugalGUID; - uint8 uiPhase; - uint16 uiTimer; + uint64 DoorCourtyardGUID; + uint64 DoorSorcererGUID; + uint64 DoorArugalGUID; - void Initialize() - { - memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); + uint8 uiPhase; + uint16 uiTimer; - uiAshGUID = 0; - uiAdaGUID = 0; - uiArchmageArugalGUID = 0; + void Initialize() + { + memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - DoorCourtyardGUID = 0; - DoorSorcererGUID = 0; - DoorArugalGUID = 0; + uiAshGUID = 0; + uiAdaGUID = 0; + uiArchmageArugalGUID = 0; - uiPhase = 0; - uiTimer = 0; - } + DoorCourtyardGUID = 0; + DoorSorcererGUID = 0; + DoorArugalGUID = 0; - void OnCreatureCreate(Creature* pCreature, bool /*add*/) - { - switch(pCreature->GetEntry()) - { - case NPC_ASH: uiAshGUID = pCreature->GetGUID(); break; - case NPC_ADA: uiAdaGUID = pCreature->GetGUID(); break; - case NPC_ARCHMAGE_ARUGAL: uiArchmageArugalGUID = pCreature->GetGUID(); break; + uiPhase = 0; + uiTimer = 0; } - } - void OnGameObjectCreate(GameObject* pGo, bool /*add*/) - { - switch(pGo->GetEntry()) + void OnCreatureCreate(Creature* pCreature, bool /*add*/) { - case GO_COURTYARD_DOOR: - DoorCourtyardGUID = pGo->GetGUID(); - if (m_auiEncounter[0] == DONE) - HandleGameObject(NULL, true, pGo); - break; - case GO_SORCERER_DOOR: - DoorSorcererGUID = pGo->GetGUID(); - if (m_auiEncounter[2] == DONE) - HandleGameObject(NULL, true, pGo); - break; - case GO_ARUGAL_DOOR: - DoorArugalGUID = pGo->GetGUID(); - if (m_auiEncounter[3] == DONE) - HandleGameObject(NULL, true, pGo); - break; + switch(pCreature->GetEntry()) + { + case NPC_ASH: uiAshGUID = pCreature->GetGUID(); break; + case NPC_ADA: uiAdaGUID = pCreature->GetGUID(); break; + case NPC_ARCHMAGE_ARUGAL: uiArchmageArugalGUID = pCreature->GetGUID(); break; + } } - } - - void DoSpeech() - { - Creature* pAda = instance->GetCreature(uiAdaGUID); - Creature* pAsh = instance->GetCreature(uiAshGUID); - if (pAda && pAda->isAlive() && pAsh && pAsh->isAlive()) + void OnGameObjectCreate(GameObject* pGo, bool /*add*/) { - DoScriptText(SAY_BOSS_DIE_AD,pAda); - DoScriptText(SAY_BOSS_DIE_AS,pAsh); + switch(pGo->GetEntry()) + { + case GO_COURTYARD_DOOR: + DoorCourtyardGUID = pGo->GetGUID(); + if (m_auiEncounter[0] == DONE) + HandleGameObject(NULL, true, pGo); + break; + case GO_SORCERER_DOOR: + DoorSorcererGUID = pGo->GetGUID(); + if (m_auiEncounter[2] == DONE) + HandleGameObject(NULL, true, pGo); + break; + case GO_ARUGAL_DOOR: + DoorArugalGUID = pGo->GetGUID(); + if (m_auiEncounter[3] == DONE) + HandleGameObject(NULL, true, pGo); + break; + } } - } - void SetData(uint32 type, uint32 data) - { - switch(type) + void DoSpeech() { - case TYPE_FREE_NPC: - if (data == DONE) - DoUseDoorOrButton(DoorCourtyardGUID); - m_auiEncounter[0] = data; - break; - case TYPE_RETHILGORE: - if (data == DONE) - DoSpeech(); - m_auiEncounter[1] = data; - break; - case TYPE_FENRUS: - switch(data) - { - case DONE: - uiTimer = 1000; - uiPhase = 1; - break; - case 7: - DoUseDoorOrButton(DoorSorcererGUID); - break; - } - m_auiEncounter[2] = data; - break; - case TYPE_NANDOS: - if (data == DONE) - DoUseDoorOrButton(DoorArugalGUID); - m_auiEncounter[3] = data; - break; + Creature* pAda = instance->GetCreature(uiAdaGUID); + Creature* pAsh = instance->GetCreature(uiAshGUID); + + if (pAda && pAda->isAlive() && pAsh && pAsh->isAlive()) + { + DoScriptText(SAY_BOSS_DIE_AD,pAda); + DoScriptText(SAY_BOSS_DIE_AS,pAsh); + } } - if (data == DONE) + void SetData(uint32 type, uint32 data) { - OUT_SAVE_INST_DATA; + switch(type) + { + case TYPE_FREE_NPC: + if (data == DONE) + DoUseDoorOrButton(DoorCourtyardGUID); + m_auiEncounter[0] = data; + break; + case TYPE_RETHILGORE: + if (data == DONE) + DoSpeech(); + m_auiEncounter[1] = data; + break; + case TYPE_FENRUS: + switch(data) + { + case DONE: + uiTimer = 1000; + uiPhase = 1; + break; + case 7: + DoUseDoorOrButton(DoorSorcererGUID); + break; + } + m_auiEncounter[2] = data; + break; + case TYPE_NANDOS: + if (data == DONE) + DoUseDoorOrButton(DoorArugalGUID); + m_auiEncounter[3] = data; + break; + } + + if (data == DONE) + { + OUT_SAVE_INST_DATA; - std::ostringstream saveStream; - saveStream << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " << m_auiEncounter[2] << " " << m_auiEncounter[3]; + std::ostringstream saveStream; + saveStream << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " << m_auiEncounter[2] << " " << m_auiEncounter[3]; - str_data = saveStream.str(); + str_data = saveStream.str(); - SaveToDB(); - OUT_SAVE_INST_DATA_COMPLETE; + SaveToDB(); + OUT_SAVE_INST_DATA_COMPLETE; + } } - } - uint32 GetData(uint32 type) - { - switch(type) + uint32 GetData(uint32 type) { - case TYPE_FREE_NPC: - return m_auiEncounter[0]; - case TYPE_RETHILGORE: - return m_auiEncounter[1]; - case TYPE_FENRUS: - return m_auiEncounter[2]; - case TYPE_NANDOS: - return m_auiEncounter[3]; + switch(type) + { + case TYPE_FREE_NPC: + return m_auiEncounter[0]; + case TYPE_RETHILGORE: + return m_auiEncounter[1]; + case TYPE_FENRUS: + return m_auiEncounter[2]; + case TYPE_NANDOS: + return m_auiEncounter[3]; + } + return 0; } - return 0; - } - - std::string GetSaveData() - { - return str_data; - } - void Load(const char* in) - { - if (!in) + std::string GetSaveData() { - OUT_LOAD_INST_DATA_FAIL; - return; + return str_data; } - OUT_LOAD_INST_DATA(in); - - std::istringstream loadStream(in); - loadStream >> m_auiEncounter[0] >> m_auiEncounter[1] >> m_auiEncounter[2] >> m_auiEncounter[3]; - - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + void Load(const char* in) { - if (m_auiEncounter[i] == IN_PROGRESS) - m_auiEncounter[i] = NOT_STARTED; - } + if (!in) + { + OUT_LOAD_INST_DATA_FAIL; + return; + } - OUT_LOAD_INST_DATA_COMPLETE; - } + OUT_LOAD_INST_DATA(in); - void Update(uint32 uiDiff) - { - if (GetData(TYPE_FENRUS) != DONE) - return; + std::istringstream loadStream(in); + loadStream >> m_auiEncounter[0] >> m_auiEncounter[1] >> m_auiEncounter[2] >> m_auiEncounter[3]; - Creature* pArchmage = instance->GetCreature(uiArchmageArugalGUID); - Creature* pSummon = NULL; + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + { + if (m_auiEncounter[i] == IN_PROGRESS) + m_auiEncounter[i] = NOT_STARTED; + } - if (!pArchmage || !pArchmage->isAlive()) - return; + OUT_LOAD_INST_DATA_COMPLETE; + } - if (uiPhase) + void Update(uint32 uiDiff) { - if (uiTimer <= uiDiff) + if (GetData(TYPE_FENRUS) != DONE) + return; + + Creature* pArchmage = instance->GetCreature(uiArchmageArugalGUID); + Creature* pSummon = NULL; + + if (!pArchmage || !pArchmage->isAlive()) + return; + + if (uiPhase) { - switch(uiPhase) + if (uiTimer <= uiDiff) { - case 1: - pSummon = pArchmage->SummonCreature(pArchmage->GetEntry(),SpawnLocation[4],TEMPSUMMON_TIMED_DESPAWN,10000); - pSummon->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); - pSummon->SetReactState(REACT_DEFENSIVE); - pSummon->CastSpell(pSummon,SPELL_ASHCROMBE_TELEPORT,true); - DoScriptText(SAY_ARCHMAGE,pSummon); - uiTimer = 2000; - uiPhase = 2; - break; - case 2: - pArchmage->SummonCreature(NPC_ARUGAL_VOIDWALKER,SpawnLocation[0],TEMPSUMMON_CORPSE_TIMED_DESPAWN,60000); - pArchmage->SummonCreature(NPC_ARUGAL_VOIDWALKER,SpawnLocation[1],TEMPSUMMON_CORPSE_TIMED_DESPAWN,60000); - pArchmage->SummonCreature(NPC_ARUGAL_VOIDWALKER,SpawnLocation[2],TEMPSUMMON_CORPSE_TIMED_DESPAWN,60000); - pArchmage->SummonCreature(NPC_ARUGAL_VOIDWALKER,SpawnLocation[3],TEMPSUMMON_CORPSE_TIMED_DESPAWN,60000); - uiPhase = 0; - break; - - } - } else uiTimer -= uiDiff; + switch(uiPhase) + { + case 1: + pSummon = pArchmage->SummonCreature(pArchmage->GetEntry(),SpawnLocation[4],TEMPSUMMON_TIMED_DESPAWN,10000); + pSummon->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + pSummon->SetReactState(REACT_DEFENSIVE); + pSummon->CastSpell(pSummon,SPELL_ASHCROMBE_TELEPORT,true); + DoScriptText(SAY_ARCHMAGE,pSummon); + uiTimer = 2000; + uiPhase = 2; + break; + case 2: + pArchmage->SummonCreature(NPC_ARUGAL_VOIDWALKER,SpawnLocation[0],TEMPSUMMON_CORPSE_TIMED_DESPAWN,60000); + pArchmage->SummonCreature(NPC_ARUGAL_VOIDWALKER,SpawnLocation[1],TEMPSUMMON_CORPSE_TIMED_DESPAWN,60000); + pArchmage->SummonCreature(NPC_ARUGAL_VOIDWALKER,SpawnLocation[2],TEMPSUMMON_CORPSE_TIMED_DESPAWN,60000); + pArchmage->SummonCreature(NPC_ARUGAL_VOIDWALKER,SpawnLocation[3],TEMPSUMMON_CORPSE_TIMED_DESPAWN,60000); + uiPhase = 0; + break; + + } + } else uiTimer -= uiDiff; + } } - } + }; + }; -InstanceData* GetInstanceData_instance_shadowfang_keep(Map* pMap) -{ - return new instance_shadowfang_keep(pMap); -} void AddSC_instance_shadowfang_keep() { - Script *newscript; - newscript = new Script; - newscript->Name = "instance_shadowfang_keep"; - newscript->GetInstanceData = &GetInstanceData_instance_shadowfang_keep; - newscript->RegisterSelf(); + new instance_shadowfang_keep(); } - diff --git a/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.cpp b/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.cpp index 61f06276bb6..a66ff361eaf 100644 --- a/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.cpp +++ b/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.cpp @@ -52,149 +52,153 @@ enum eEnums }; #define GOSSIP_ITEM_DOOR "Thanks, I'll follow you to the door." - -struct npc_shadowfang_prisonerAI : public npc_escortAI +
class npc_shadowfang_prisoner : public CreatureScript { - npc_shadowfang_prisonerAI(Creature *c) : npc_escortAI(c) +public: + npc_shadowfang_prisoner() : CreatureScript("npc_shadowfang_prisoner") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); - uiNpcEntry = c->GetEntry(); + return new npc_shadowfang_prisonerAI(pCreature); } - ScriptedInstance *pInstance; - uint32 uiNpcEntry; - - void WaypointReached(uint32 uiPoint) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - switch(uiPoint) + if (uiAction == GOSSIP_ACTION_INFO_DEF+1) { - case 0: - if (uiNpcEntry == NPC_ASH) - DoScriptText(SAY_FREE_AS, me); - else - DoScriptText(SAY_FREE_AD, me); - break; - case 10: - if (uiNpcEntry == NPC_ASH) - DoScriptText(SAY_OPEN_DOOR_AS, me); - else - DoScriptText(SAY_OPEN_DOOR_AD, me); - break; - case 11: - if (uiNpcEntry == NPC_ASH) - DoCast(me, SPELL_UNLOCK); - break; - case 12: - if (uiNpcEntry == NPC_ASH) - DoScriptText(SAY_POST_DOOR_AS, me); - else - DoScriptText(SAY_POST1_DOOR_AD, me); - - if (pInstance) - pInstance->SetData(TYPE_FREE_NPC, DONE); - break; - case 13: - if (uiNpcEntry != NPC_ASH) - DoScriptText(SAY_POST2_DOOR_AD, me); - break; + pPlayer->CLOSE_GOSSIP_MENU(); + + if (npc_escortAI* pEscortAI = CAST_AI(npc_shadowfang_prisoner::npc_shadowfang_prisonerAI, pCreature->AI())) + pEscortAI->Start(false, false); } + return true; } - void Reset() {} - void EnterCombat(Unit* /*who*/) {} -}; + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + InstanceScript* pInstance = pCreature->GetInstanceScript(); -CreatureAI* GetAI_npc_shadowfang_prisoner(Creature* pCreature) -{ - return new npc_shadowfang_prisonerAI(pCreature); -} + if (pInstance && pInstance->GetData(TYPE_FREE_NPC) != DONE && pInstance->GetData(TYPE_RETHILGORE) == DONE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_DOOR, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); -bool GossipHello_npc_shadowfang_prisoner(Player* pPlayer, Creature* pCreature) -{ - ScriptedInstance* pInstance = pCreature->GetInstanceData(); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - if (pInstance && pInstance->GetData(TYPE_FREE_NPC) != DONE && pInstance->GetData(TYPE_RETHILGORE) == DONE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_DOOR, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + return true; + } - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + struct npc_shadowfang_prisonerAI : public npc_escortAI + { + npc_shadowfang_prisonerAI(Creature *c) : npc_escortAI(c) + { + pInstance = c->GetInstanceScript(); + uiNpcEntry = c->GetEntry(); + } - return true; -} + InstanceScript *pInstance; + uint32 uiNpcEntry; -bool GossipSelect_npc_shadowfang_prisoner(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) - { - pPlayer->CLOSE_GOSSIP_MENU(); + void WaypointReached(uint32 uiPoint) + { + switch(uiPoint) + { + case 0: + if (uiNpcEntry == NPC_ASH) + DoScriptText(SAY_FREE_AS, me); + else + DoScriptText(SAY_FREE_AD, me); + break; + case 10: + if (uiNpcEntry == NPC_ASH) + DoScriptText(SAY_OPEN_DOOR_AS, me); + else + DoScriptText(SAY_OPEN_DOOR_AD, me); + break; + case 11: + if (uiNpcEntry == NPC_ASH) + DoCast(me, SPELL_UNLOCK); + break; + case 12: + if (uiNpcEntry == NPC_ASH) + DoScriptText(SAY_POST_DOOR_AS, me); + else + DoScriptText(SAY_POST1_DOOR_AD, me); + + if (pInstance) + pInstance->SetData(TYPE_FREE_NPC, DONE); + break; + case 13: + if (uiNpcEntry != NPC_ASH) + DoScriptText(SAY_POST2_DOOR_AD, me); + break; + } + } - if (npc_escortAI* pEscortAI = CAST_AI(npc_shadowfang_prisonerAI, pCreature->AI())) - pEscortAI->Start(false, false); - } - return true; -} + void Reset() {} + void EnterCombat(Unit* /*who*/) {} + }; -struct npc_arugal_voidwalkerAI : public ScriptedAI -{ - npc_arugal_voidwalkerAI(Creature* pCreature) : ScriptedAI(pCreature) - { - pInstance = pCreature->GetInstanceData(); - } +}; - ScriptedInstance* pInstance; - uint32 uiDarkOffering; - void Reset() +
class npc_arugal_voidwalker : public CreatureScript +{ +public: + npc_arugal_voidwalker() : CreatureScript("npc_arugal_voidwalker") { } + + CreatureAI* GetAI(Creature* pCreature) const { - uiDarkOffering = urand(290,10); + return new npc_arugal_voidwalkerAI(pCreature); } - void UpdateAI(uint32 const uiDiff) + struct npc_arugal_voidwalkerAI : public ScriptedAI { - if (!UpdateVictim()) - return; + npc_arugal_voidwalkerAI(Creature* pCreature) : ScriptedAI(pCreature) + { + pInstance = pCreature->GetInstanceScript(); + } - if (uiDarkOffering <= uiDiff) + InstanceScript* pInstance; + + uint32 uiDarkOffering; + + void Reset() + { + uiDarkOffering = urand(290,10); + } + + void UpdateAI(uint32 const uiDiff) { - if (Creature* pFriend = me->FindNearestCreature(me->GetEntry(),25.0f,true)) + if (!UpdateVictim()) + return; + + if (uiDarkOffering <= uiDiff) { - if (pFriend) - DoCast(pFriend,SPELL_DARK_OFFERING); - } - else - DoCast(me,SPELL_DARK_OFFERING); - uiDarkOffering = urand(4400,12500); - } else uiDarkOffering -= uiDiff; + if (Creature* pFriend = me->FindNearestCreature(me->GetEntry(),25.0f,true)) + { + if (pFriend) + DoCast(pFriend,SPELL_DARK_OFFERING); + } + else + DoCast(me,SPELL_DARK_OFFERING); + uiDarkOffering = urand(4400,12500); + } else uiDarkOffering -= uiDiff; - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } + + void JustDied(Unit* /*pKiller*/) + { + if (pInstance) + pInstance->SetData(TYPE_FENRUS, pInstance->GetData(TYPE_FENRUS) + 1); + } + }; - void JustDied(Unit* /*pKiller*/) - { - if (pInstance) - pInstance->SetData(TYPE_FENRUS, pInstance->GetData(TYPE_FENRUS) + 1); - } }; -CreatureAI* GetAI_npc_arugal_voidwalker(Creature* pCreature) -{ - return new npc_arugal_voidwalkerAI(pCreature); -} void AddSC_shadowfang_keep() { - Script* newscript; - - newscript = new Script; - newscript->Name = "npc_shadowfang_prisoner"; - newscript->pGossipHello = &GossipHello_npc_shadowfang_prisoner; - newscript->pGossipSelect = &GossipSelect_npc_shadowfang_prisoner; - newscript->GetAI = &GetAI_npc_shadowfang_prisoner; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_arugal_voidwalker"; - newscript->GetAI = &GetAI_npc_arugal_voidwalker; - newscript->RegisterSelf(); + new npc_shadowfang_prisoner(); + new npc_arugal_voidwalker(); } - diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_baron_rivendare.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_baron_rivendare.cpp index ca2ca46d198..33af2acdb57 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/boss_baron_rivendare.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_baron_rivendare.cpp @@ -76,117 +76,119 @@ EndScriptData */ #define SPELL_RAISE_DEAD4 17478 #define SPELL_RAISE_DEAD5 17479 #define SPELL_RAISE_DEAD6 17480 - -struct boss_baron_rivendareAI : public ScriptedAI +
class boss_baron_rivendare : public CreatureScript { - boss_baron_rivendareAI(Creature *c) : ScriptedAI(c) - { - pInstance = me->GetInstanceData(); - } - - ScriptedInstance* pInstance; - - uint32 ShadowBolt_Timer; - uint32 Cleave_Timer; - uint32 MortalStrike_Timer; - // uint32 RaiseDead_Timer; - uint32 SummonSkeletons_Timer; +public: + boss_baron_rivendare() : CreatureScript("boss_baron_rivendare") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - ShadowBolt_Timer = 5000; - Cleave_Timer = 8000; - MortalStrike_Timer = 12000; - // RaiseDead_Timer = 30000; - SummonSkeletons_Timer = 34000; - if (pInstance && pInstance->GetData(TYPE_RAMSTEIN) == DONE) - pInstance->SetData(TYPE_BARON,NOT_STARTED); + return new boss_baron_rivendareAI (pCreature); } - void AttackStart(Unit* who) + struct boss_baron_rivendareAI : public ScriptedAI { - if (pInstance)//can't use entercombat(), boss' dmg aura sets near players in combat, before entering the room's door - pInstance->SetData(TYPE_BARON,IN_PROGRESS); - ScriptedAI::AttackStart(who); - } + boss_baron_rivendareAI(Creature *c) : ScriptedAI(c) + { + pInstance = me->GetInstanceScript(); + } - void JustSummoned(Creature* summoned) - { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) - summoned->AI()->AttackStart(pTarget); - } + InstanceScript* pInstance; - void JustDied(Unit* /*Killer*/) - { - if (pInstance) - pInstance->SetData(TYPE_BARON,DONE); - } + uint32 ShadowBolt_Timer; + uint32 Cleave_Timer; + uint32 MortalStrike_Timer; + // uint32 RaiseDead_Timer; + uint32 SummonSkeletons_Timer; - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + void Reset() + { + ShadowBolt_Timer = 5000; + Cleave_Timer = 8000; + MortalStrike_Timer = 12000; + // RaiseDead_Timer = 30000; + SummonSkeletons_Timer = 34000; + if (pInstance && pInstance->GetData(TYPE_RAMSTEIN) == DONE) + pInstance->SetData(TYPE_BARON,NOT_STARTED); + } + + void AttackStart(Unit* who) + { + if (pInstance)//can't use entercombat(), boss' dmg aura sets near players in combat, before entering the room's door + pInstance->SetData(TYPE_BARON,IN_PROGRESS); + ScriptedAI::AttackStart(who); + } - //ShadowBolt - if (ShadowBolt_Timer <= diff) + void JustSummoned(Creature* summoned) { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(me->getVictim(), SPELL_SHADOWBOLT); + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + summoned->AI()->AttackStart(pTarget); + } - ShadowBolt_Timer = 10000; - } else ShadowBolt_Timer -= diff; + void JustDied(Unit* /*Killer*/) + { + if (pInstance) + pInstance->SetData(TYPE_BARON,DONE); + } - //Cleave - if (Cleave_Timer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_CLEAVE); - //13 seconds until we should cast this again - Cleave_Timer = 7000 + (rand()%10000); - } else Cleave_Timer -= diff; + if (!UpdateVictim()) + return; + + //ShadowBolt + if (ShadowBolt_Timer <= diff) + { + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(me->getVictim(), SPELL_SHADOWBOLT); + + ShadowBolt_Timer = 10000; + } else ShadowBolt_Timer -= diff; + + //Cleave + if (Cleave_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_CLEAVE); + //13 seconds until we should cast this again + Cleave_Timer = 7000 + (rand()%10000); + } else Cleave_Timer -= diff; + + //MortalStrike + if (MortalStrike_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_MORTALSTRIKE); + MortalStrike_Timer = 10000 + (rand()%15000); + } else MortalStrike_Timer -= diff; + + //RaiseDead + // if (RaiseDead_Timer <= diff) + // { + // DoCast(me, SPELL_RAISEDEAD); + // RaiseDead_Timer = 45000; + // } else RaiseDead_Timer -= diff; + + //SummonSkeletons + if (SummonSkeletons_Timer <= diff) + { + me->SummonCreature(11197,ADD_1X,ADD_1Y,ADD_1Z,ADD_1O,TEMPSUMMON_TIMED_DESPAWN,29000); + me->SummonCreature(11197,ADD_2X,ADD_2Y,ADD_2Z,ADD_2O,TEMPSUMMON_TIMED_DESPAWN,29000); + me->SummonCreature(11197,ADD_3X,ADD_3Y,ADD_3Z,ADD_3O,TEMPSUMMON_TIMED_DESPAWN,29000); + me->SummonCreature(11197,ADD_4X,ADD_4Y,ADD_4Z,ADD_4O,TEMPSUMMON_TIMED_DESPAWN,29000); + me->SummonCreature(11197,ADD_5X,ADD_5Y,ADD_5Z,ADD_5O,TEMPSUMMON_TIMED_DESPAWN,29000); + me->SummonCreature(11197,ADD_6X,ADD_6Y,ADD_6Z,ADD_6O,TEMPSUMMON_TIMED_DESPAWN,29000); + + //34 seconds until we should cast this again + SummonSkeletons_Timer = 40000; + } else SummonSkeletons_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - //MortalStrike - if (MortalStrike_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_MORTALSTRIKE); - MortalStrike_Timer = 10000 + (rand()%15000); - } else MortalStrike_Timer -= diff; - - //RaiseDead - // if (RaiseDead_Timer <= diff) - // { - // DoCast(me, SPELL_RAISEDEAD); - // RaiseDead_Timer = 45000; - // } else RaiseDead_Timer -= diff; - - //SummonSkeletons - if (SummonSkeletons_Timer <= diff) - { - me->SummonCreature(11197,ADD_1X,ADD_1Y,ADD_1Z,ADD_1O,TEMPSUMMON_TIMED_DESPAWN,29000); - me->SummonCreature(11197,ADD_2X,ADD_2Y,ADD_2Z,ADD_2O,TEMPSUMMON_TIMED_DESPAWN,29000); - me->SummonCreature(11197,ADD_3X,ADD_3Y,ADD_3Z,ADD_3O,TEMPSUMMON_TIMED_DESPAWN,29000); - me->SummonCreature(11197,ADD_4X,ADD_4Y,ADD_4Z,ADD_4O,TEMPSUMMON_TIMED_DESPAWN,29000); - me->SummonCreature(11197,ADD_5X,ADD_5Y,ADD_5Z,ADD_5O,TEMPSUMMON_TIMED_DESPAWN,29000); - me->SummonCreature(11197,ADD_6X,ADD_6Y,ADD_6Z,ADD_6O,TEMPSUMMON_TIMED_DESPAWN,29000); - - //34 seconds until we should cast this again - SummonSkeletons_Timer = 40000; - } else SummonSkeletons_Timer -= diff; - - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_baron_rivendare(Creature* pCreature) -{ - return new boss_baron_rivendareAI (pCreature); -} void AddSC_boss_baron_rivendare() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_baron_rivendare"; - newscript->GetAI = &GetAI_boss_baron_rivendare; - newscript->RegisterSelf(); + new boss_baron_rivendare(); } - diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_baroness_anastari.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_baroness_anastari.cpp index ba2a49a1804..ddf3e3a7e3d 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/boss_baroness_anastari.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_baroness_anastari.cpp @@ -30,100 +30,102 @@ EndScriptData */ #define SPELL_BANSHEECURSE 16867 #define SPELL_SILENCE 18327 //#define SPELL_POSSESS 17244 - -struct boss_baroness_anastariAI : public ScriptedAI +
class boss_baroness_anastari : public CreatureScript { - boss_baroness_anastariAI(Creature *c) : ScriptedAI(c) - { - pInstance = me->GetInstanceData(); - } - - ScriptedInstance* pInstance; - - uint32 BansheeWail_Timer; - uint32 BansheeCurse_Timer; - uint32 Silence_Timer; - //uint32 Possess_Timer; +public: + boss_baroness_anastari() : CreatureScript("boss_baroness_anastari") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - BansheeWail_Timer = 1000; - BansheeCurse_Timer = 11000; - Silence_Timer = 13000; - //Possess_Timer = 35000; + return new boss_baroness_anastariAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_baroness_anastariAI : public ScriptedAI { - } + boss_baroness_anastariAI(Creature *c) : ScriptedAI(c) + { + pInstance = me->GetInstanceScript(); + } - void JustDied(Unit* /*Killer*/) - { - if (pInstance) - pInstance->SetData(TYPE_BARONESS,IN_PROGRESS); - } + InstanceScript* pInstance; - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + uint32 BansheeWail_Timer; + uint32 BansheeCurse_Timer; + uint32 Silence_Timer; + //uint32 Possess_Timer; - //BansheeWail - if (BansheeWail_Timer <= diff) - { - if (rand()%100 < 95) - DoCast(me->getVictim(), SPELL_BANSHEEWAIL); - //4 seconds until we should cast this again - BansheeWail_Timer = 4000; - } else BansheeWail_Timer -= diff; - - //BansheeCurse - if (BansheeCurse_Timer <= diff) + void Reset() { - if (rand()%100 < 75) - DoCast(me->getVictim(), SPELL_BANSHEECURSE); - //18 seconds until we should cast this again - BansheeCurse_Timer = 18000; - } else BansheeCurse_Timer -= diff; - - //Silence - if (Silence_Timer <= diff) - { - if (rand()%100 < 80) - DoCast(me->getVictim(), SPELL_SILENCE); - //13 seconds until we should cast this again + BansheeWail_Timer = 1000; + BansheeCurse_Timer = 11000; Silence_Timer = 13000; - } else Silence_Timer -= diff; + //Possess_Timer = 35000; + } - //Possess - /* if (Possess_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - //Cast - if (rand()%100 < 65) + } + + void JustDied(Unit* /*Killer*/) + { + if (pInstance) + pInstance->SetData(TYPE_BARONESS,IN_PROGRESS); + } + + void UpdateAI(const uint32 diff) { - Unit *pTarget = NULL; - pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); - if (pTarget)DoCast(pTarget, SPELL_POSSESS); + if (!UpdateVictim()) + return; + + //BansheeWail + if (BansheeWail_Timer <= diff) + { + if (rand()%100 < 95) + DoCast(me->getVictim(), SPELL_BANSHEEWAIL); + //4 seconds until we should cast this again + BansheeWail_Timer = 4000; + } else BansheeWail_Timer -= diff; + + //BansheeCurse + if (BansheeCurse_Timer <= diff) + { + if (rand()%100 < 75) + DoCast(me->getVictim(), SPELL_BANSHEECURSE); + //18 seconds until we should cast this again + BansheeCurse_Timer = 18000; + } else BansheeCurse_Timer -= diff; + + //Silence + if (Silence_Timer <= diff) + { + if (rand()%100 < 80) + DoCast(me->getVictim(), SPELL_SILENCE); + //13 seconds until we should cast this again + Silence_Timer = 13000; + } else Silence_Timer -= diff; + + //Possess + /* if (Possess_Timer <= diff) + { + //Cast + if (rand()%100 < 65) + { + Unit *pTarget = NULL; + pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); + if (pTarget)DoCast(pTarget, SPELL_POSSESS); + } + //50 seconds until we should cast this again + Possess_Timer = 50000; + } else Possess_Timer -= diff; + */ + + DoMeleeAttackIfReady(); } - //50 seconds until we should cast this again - Possess_Timer = 50000; - } else Possess_Timer -= diff; - */ + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_baroness_anastari(Creature* pCreature) -{ - return new boss_baroness_anastariAI (pCreature); -} void AddSC_boss_baroness_anastari() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_baroness_anastari"; - newscript->GetAI = &GetAI_boss_baroness_anastari; - newscript->RegisterSelf(); + new boss_baroness_anastari(); } - diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_cannon_master_willey.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_cannon_master_willey.cpp index 0de4d122904..eb4bbdec36c 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/boss_cannon_master_willey.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_cannon_master_willey.cpp @@ -75,148 +75,150 @@ EndScriptData */ #define SPELL_PUMMEL 15615 #define SPELL_SHOOT 16496 //#define SPELL_SUMMONCRIMSONRIFLEMAN 17279 - -struct boss_cannon_master_willeyAI : public ScriptedAI +
class boss_cannon_master_willey : public CreatureScript { - boss_cannon_master_willeyAI(Creature *c) : ScriptedAI(c) {} - - uint32 KnockAway_Timer; - uint32 Pummel_Timer; - uint32 Shoot_Timer; - uint32 SummonRifleman_Timer; +public: + boss_cannon_master_willey() : CreatureScript("boss_cannon_master_willey") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - Shoot_Timer = 1000; - Pummel_Timer = 7000; - KnockAway_Timer = 11000; - SummonRifleman_Timer = 15000; + return new boss_cannon_master_willeyAI (pCreature); } - void JustDied(Unit* /*Victim*/) + struct boss_cannon_master_willeyAI : public ScriptedAI { - me->SummonCreature(11054,ADD_1X,ADD_1Y,ADD_1Z,ADD_1O,TEMPSUMMON_TIMED_DESPAWN,240000); - me->SummonCreature(11054,ADD_2X,ADD_2Y,ADD_2Z,ADD_2O,TEMPSUMMON_TIMED_DESPAWN,240000); - me->SummonCreature(11054,ADD_3X,ADD_3Y,ADD_3Z,ADD_3O,TEMPSUMMON_TIMED_DESPAWN,240000); - me->SummonCreature(11054,ADD_4X,ADD_4Y,ADD_4Z,ADD_4O,TEMPSUMMON_TIMED_DESPAWN,240000); - me->SummonCreature(11054,ADD_5X,ADD_5Y,ADD_5Z,ADD_5O,TEMPSUMMON_TIMED_DESPAWN,240000); - me->SummonCreature(11054,ADD_7X,ADD_7Y,ADD_7Z,ADD_7O,TEMPSUMMON_TIMED_DESPAWN,240000); - me->SummonCreature(11054,ADD_9X,ADD_9Y,ADD_9Z,ADD_9O,TEMPSUMMON_TIMED_DESPAWN,240000); - } + boss_cannon_master_willeyAI(Creature *c) : ScriptedAI(c) {} - void EnterCombat(Unit * /*who*/) - { - } + uint32 KnockAway_Timer; + uint32 Pummel_Timer; + uint32 Shoot_Timer; + uint32 SummonRifleman_Timer; - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - //Pummel - if (Pummel_Timer <= diff) + void Reset() { - //Cast - if (rand()%100 < 90) //90% chance to cast - { - DoCast(me->getVictim(), SPELL_PUMMEL); - } - //12 seconds until we should cast this again - Pummel_Timer = 12000; - } else Pummel_Timer -= diff; - - //KnockAway - if (KnockAway_Timer <= diff) + Shoot_Timer = 1000; + Pummel_Timer = 7000; + KnockAway_Timer = 11000; + SummonRifleman_Timer = 15000; + } + + void JustDied(Unit* /*Victim*/) { - //Cast - if (rand()%100 < 80) //80% chance to cast - { - DoCast(me->getVictim(), SPELL_KNOCKAWAY); - } - //14 seconds until we should cast this again - KnockAway_Timer = 14000; - } else KnockAway_Timer -= diff; - - //Shoot - if (Shoot_Timer <= diff) + me->SummonCreature(11054,ADD_1X,ADD_1Y,ADD_1Z,ADD_1O,TEMPSUMMON_TIMED_DESPAWN,240000); + me->SummonCreature(11054,ADD_2X,ADD_2Y,ADD_2Z,ADD_2O,TEMPSUMMON_TIMED_DESPAWN,240000); + me->SummonCreature(11054,ADD_3X,ADD_3Y,ADD_3Z,ADD_3O,TEMPSUMMON_TIMED_DESPAWN,240000); + me->SummonCreature(11054,ADD_4X,ADD_4Y,ADD_4Z,ADD_4O,TEMPSUMMON_TIMED_DESPAWN,240000); + me->SummonCreature(11054,ADD_5X,ADD_5Y,ADD_5Z,ADD_5O,TEMPSUMMON_TIMED_DESPAWN,240000); + me->SummonCreature(11054,ADD_7X,ADD_7Y,ADD_7Z,ADD_7O,TEMPSUMMON_TIMED_DESPAWN,240000); + me->SummonCreature(11054,ADD_9X,ADD_9Y,ADD_9Z,ADD_9O,TEMPSUMMON_TIMED_DESPAWN,240000); + } + + void EnterCombat(Unit * /*who*/) { - //Cast - DoCast(me->getVictim(), SPELL_SHOOT); - //1 seconds until we should cast this again - Shoot_Timer = 1000; - } else Shoot_Timer -= diff; + } - //SummonRifleman - if (SummonRifleman_Timer <= diff) + void UpdateAI(const uint32 diff) { - //Cast - switch (rand()%9) + //Return since we have no target + if (!UpdateVictim()) + return; + + //Pummel + if (Pummel_Timer <= diff) { - case 0: - me->SummonCreature(11054,ADD_1X,ADD_1Y,ADD_1Z,ADD_1O,TEMPSUMMON_TIMED_DESPAWN,240000); - me->SummonCreature(11054,ADD_2X,ADD_2Y,ADD_2Z,ADD_2O,TEMPSUMMON_TIMED_DESPAWN,240000); - me->SummonCreature(11054,ADD_4X,ADD_4Y,ADD_4Z,ADD_4O,TEMPSUMMON_TIMED_DESPAWN,240000); - break; - case 1: - me->SummonCreature(11054,ADD_2X,ADD_2Y,ADD_2Z,ADD_2O,TEMPSUMMON_TIMED_DESPAWN,240000); - me->SummonCreature(11054,ADD_3X,ADD_3Y,ADD_3Z,ADD_3O,TEMPSUMMON_TIMED_DESPAWN,240000); - me->SummonCreature(11054,ADD_5X,ADD_5Y,ADD_5Z,ADD_5O,TEMPSUMMON_TIMED_DESPAWN,240000); - break; - case 2: - me->SummonCreature(11054,ADD_3X,ADD_3Y,ADD_3Z,ADD_3O,TEMPSUMMON_TIMED_DESPAWN,240000); - me->SummonCreature(11054,ADD_4X,ADD_4Y,ADD_4Z,ADD_4O,TEMPSUMMON_TIMED_DESPAWN,240000); - me->SummonCreature(11054,ADD_6X,ADD_6Y,ADD_6Z,ADD_6O,TEMPSUMMON_TIMED_DESPAWN,240000); - break; - case 3: - me->SummonCreature(11054,ADD_4X,ADD_4Y,ADD_4Z,ADD_4O,TEMPSUMMON_TIMED_DESPAWN,240000); - me->SummonCreature(11054,ADD_5X,ADD_5Y,ADD_5Z,ADD_5O,TEMPSUMMON_TIMED_DESPAWN,240000); - me->SummonCreature(11054,ADD_7X,ADD_7Y,ADD_7Z,ADD_7O,TEMPSUMMON_TIMED_DESPAWN,240000); - break; - case 4: - me->SummonCreature(11054,ADD_5X,ADD_5Y,ADD_5Z,ADD_5O,TEMPSUMMON_TIMED_DESPAWN,240000); - me->SummonCreature(11054,ADD_6X,ADD_6Y,ADD_6Z,ADD_6O,TEMPSUMMON_TIMED_DESPAWN,240000); - me->SummonCreature(11054,ADD_8X,ADD_8Y,ADD_8Z,ADD_8O,TEMPSUMMON_TIMED_DESPAWN,240000); - break; - case 5: - me->SummonCreature(11054,ADD_6X,ADD_6Y,ADD_6Z,ADD_6O,TEMPSUMMON_TIMED_DESPAWN,240000); - me->SummonCreature(11054,ADD_7X,ADD_7Y,ADD_7Z,ADD_7O,TEMPSUMMON_TIMED_DESPAWN,240000); - me->SummonCreature(11054,ADD_9X,ADD_9Y,ADD_9Z,ADD_9O,TEMPSUMMON_TIMED_DESPAWN,240000); - break; - case 6: - me->SummonCreature(11054,ADD_7X,ADD_7Y,ADD_7Z,ADD_7O,TEMPSUMMON_TIMED_DESPAWN,240000); - me->SummonCreature(11054,ADD_8X,ADD_8Y,ADD_8Z,ADD_8O,TEMPSUMMON_TIMED_DESPAWN,240000); - me->SummonCreature(11054,ADD_1X,ADD_1Y,ADD_1Z,ADD_1O,TEMPSUMMON_TIMED_DESPAWN,240000); - break; - case 7: - me->SummonCreature(11054,ADD_8X,ADD_8Y,ADD_8Z,ADD_8O,TEMPSUMMON_TIMED_DESPAWN,240000); - me->SummonCreature(11054,ADD_9X,ADD_9Y,ADD_9Z,ADD_9O,TEMPSUMMON_TIMED_DESPAWN,240000); - me->SummonCreature(11054,ADD_2X,ADD_2Y,ADD_2Z,ADD_2O,TEMPSUMMON_TIMED_DESPAWN,240000); - break; - case 8: - me->SummonCreature(11054,ADD_9X,ADD_9Y,ADD_9Z,ADD_9O,TEMPSUMMON_TIMED_DESPAWN,240000); - me->SummonCreature(11054,ADD_1X,ADD_1Y,ADD_1Z,ADD_1O,TEMPSUMMON_TIMED_DESPAWN,240000); - me->SummonCreature(11054,ADD_3X,ADD_3Y,ADD_3Z,ADD_3O,TEMPSUMMON_TIMED_DESPAWN,240000); - break; - } - //30 seconds until we should cast this again - SummonRifleman_Timer = 30000; - } else SummonRifleman_Timer -= diff; - - DoMeleeAttackIfReady(); - } + //Cast + if (rand()%100 < 90) //90% chance to cast + { + DoCast(me->getVictim(), SPELL_PUMMEL); + } + //12 seconds until we should cast this again + Pummel_Timer = 12000; + } else Pummel_Timer -= diff; + + //KnockAway + if (KnockAway_Timer <= diff) + { + //Cast + if (rand()%100 < 80) //80% chance to cast + { + DoCast(me->getVictim(), SPELL_KNOCKAWAY); + } + //14 seconds until we should cast this again + KnockAway_Timer = 14000; + } else KnockAway_Timer -= diff; + + //Shoot + if (Shoot_Timer <= diff) + { + //Cast + DoCast(me->getVictim(), SPELL_SHOOT); + //1 seconds until we should cast this again + Shoot_Timer = 1000; + } else Shoot_Timer -= diff; + + //SummonRifleman + if (SummonRifleman_Timer <= diff) + { + //Cast + switch (rand()%9) + { + case 0: + me->SummonCreature(11054,ADD_1X,ADD_1Y,ADD_1Z,ADD_1O,TEMPSUMMON_TIMED_DESPAWN,240000); + me->SummonCreature(11054,ADD_2X,ADD_2Y,ADD_2Z,ADD_2O,TEMPSUMMON_TIMED_DESPAWN,240000); + me->SummonCreature(11054,ADD_4X,ADD_4Y,ADD_4Z,ADD_4O,TEMPSUMMON_TIMED_DESPAWN,240000); + break; + case 1: + me->SummonCreature(11054,ADD_2X,ADD_2Y,ADD_2Z,ADD_2O,TEMPSUMMON_TIMED_DESPAWN,240000); + me->SummonCreature(11054,ADD_3X,ADD_3Y,ADD_3Z,ADD_3O,TEMPSUMMON_TIMED_DESPAWN,240000); + me->SummonCreature(11054,ADD_5X,ADD_5Y,ADD_5Z,ADD_5O,TEMPSUMMON_TIMED_DESPAWN,240000); + break; + case 2: + me->SummonCreature(11054,ADD_3X,ADD_3Y,ADD_3Z,ADD_3O,TEMPSUMMON_TIMED_DESPAWN,240000); + me->SummonCreature(11054,ADD_4X,ADD_4Y,ADD_4Z,ADD_4O,TEMPSUMMON_TIMED_DESPAWN,240000); + me->SummonCreature(11054,ADD_6X,ADD_6Y,ADD_6Z,ADD_6O,TEMPSUMMON_TIMED_DESPAWN,240000); + break; + case 3: + me->SummonCreature(11054,ADD_4X,ADD_4Y,ADD_4Z,ADD_4O,TEMPSUMMON_TIMED_DESPAWN,240000); + me->SummonCreature(11054,ADD_5X,ADD_5Y,ADD_5Z,ADD_5O,TEMPSUMMON_TIMED_DESPAWN,240000); + me->SummonCreature(11054,ADD_7X,ADD_7Y,ADD_7Z,ADD_7O,TEMPSUMMON_TIMED_DESPAWN,240000); + break; + case 4: + me->SummonCreature(11054,ADD_5X,ADD_5Y,ADD_5Z,ADD_5O,TEMPSUMMON_TIMED_DESPAWN,240000); + me->SummonCreature(11054,ADD_6X,ADD_6Y,ADD_6Z,ADD_6O,TEMPSUMMON_TIMED_DESPAWN,240000); + me->SummonCreature(11054,ADD_8X,ADD_8Y,ADD_8Z,ADD_8O,TEMPSUMMON_TIMED_DESPAWN,240000); + break; + case 5: + me->SummonCreature(11054,ADD_6X,ADD_6Y,ADD_6Z,ADD_6O,TEMPSUMMON_TIMED_DESPAWN,240000); + me->SummonCreature(11054,ADD_7X,ADD_7Y,ADD_7Z,ADD_7O,TEMPSUMMON_TIMED_DESPAWN,240000); + me->SummonCreature(11054,ADD_9X,ADD_9Y,ADD_9Z,ADD_9O,TEMPSUMMON_TIMED_DESPAWN,240000); + break; + case 6: + me->SummonCreature(11054,ADD_7X,ADD_7Y,ADD_7Z,ADD_7O,TEMPSUMMON_TIMED_DESPAWN,240000); + me->SummonCreature(11054,ADD_8X,ADD_8Y,ADD_8Z,ADD_8O,TEMPSUMMON_TIMED_DESPAWN,240000); + me->SummonCreature(11054,ADD_1X,ADD_1Y,ADD_1Z,ADD_1O,TEMPSUMMON_TIMED_DESPAWN,240000); + break; + case 7: + me->SummonCreature(11054,ADD_8X,ADD_8Y,ADD_8Z,ADD_8O,TEMPSUMMON_TIMED_DESPAWN,240000); + me->SummonCreature(11054,ADD_9X,ADD_9Y,ADD_9Z,ADD_9O,TEMPSUMMON_TIMED_DESPAWN,240000); + me->SummonCreature(11054,ADD_2X,ADD_2Y,ADD_2Z,ADD_2O,TEMPSUMMON_TIMED_DESPAWN,240000); + break; + case 8: + me->SummonCreature(11054,ADD_9X,ADD_9Y,ADD_9Z,ADD_9O,TEMPSUMMON_TIMED_DESPAWN,240000); + me->SummonCreature(11054,ADD_1X,ADD_1Y,ADD_1Z,ADD_1O,TEMPSUMMON_TIMED_DESPAWN,240000); + me->SummonCreature(11054,ADD_3X,ADD_3Y,ADD_3Z,ADD_3O,TEMPSUMMON_TIMED_DESPAWN,240000); + break; + } + //30 seconds until we should cast this again + SummonRifleman_Timer = 30000; + } else SummonRifleman_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; + }; -CreatureAI* GetAI_boss_cannon_master_willey(Creature* pCreature) -{ - return new boss_cannon_master_willeyAI (pCreature); -} void AddSC_boss_cannon_master_willey() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_cannon_master_willey"; - newscript->GetAI = &GetAI_boss_cannon_master_willey; - newscript->RegisterSelf(); + new boss_cannon_master_willey(); } - diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_dathrohan_balnazzar.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_dathrohan_balnazzar.cpp index ec2fd370a16..c740bc39459 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/boss_dathrohan_balnazzar.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_dathrohan_balnazzar.cpp @@ -64,156 +64,158 @@ SummonDef m_aSummonPoint[]= {3460.975, -3078.901, 135.002, 3.784}, //G2 back left {3457.338, -3073.979, 135.002, 3.784} //G2 back, right }; - -struct boss_dathrohan_balnazzarAI : public ScriptedAI +
class boss_dathrohan_balnazzar : public CreatureScript { - boss_dathrohan_balnazzarAI(Creature *c) : ScriptedAI(c) {} - - uint32 m_uiCrusadersHammer_Timer; - uint32 m_uiCrusaderStrike_Timer; - uint32 m_uiMindBlast_Timer; - uint32 m_uiHolyStrike_Timer; - uint32 m_uiShadowShock_Timer; - uint32 m_uiPsychicScream_Timer; - uint32 m_uiDeepSleep_Timer; - uint32 m_uiMindControl_Timer; - bool m_bTransformed; - - void Reset() - { - m_uiCrusadersHammer_Timer = 8000; - m_uiCrusaderStrike_Timer = 12000; - m_uiMindBlast_Timer = 6000; - m_uiHolyStrike_Timer = 18000; - m_uiShadowShock_Timer = 4000; - m_uiPsychicScream_Timer = 16000; - m_uiDeepSleep_Timer = 20000; - m_uiMindControl_Timer = 10000; - m_bTransformed = false; - - if (me->GetEntry() == NPC_BALNAZZAR) - me->UpdateEntry(NPC_DATHROHAN); - } +public: + boss_dathrohan_balnazzar() : CreatureScript("boss_dathrohan_balnazzar") { } - void JustDied(Unit* /*Victim*/) + CreatureAI* GetAI(Creature* pCreature) const { - static uint32 uiCount = sizeof(m_aSummonPoint)/sizeof(SummonDef); - - for (uint8 i=0; i<uiCount; ++i) - me->SummonCreature(NPC_ZOMBIE, - m_aSummonPoint[i].m_fX, m_aSummonPoint[i].m_fY, m_aSummonPoint[i].m_fZ, m_aSummonPoint[i].m_fOrient, - TEMPSUMMON_TIMED_DESPAWN, HOUR*IN_MILLISECONDS); + return new boss_dathrohan_balnazzarAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_dathrohan_balnazzarAI : public ScriptedAI { - } - - void UpdateAI(const uint32 uiDiff) - { - if (!UpdateVictim()) - return; - - //START NOT TRANSFORMED - if (!m_bTransformed) + boss_dathrohan_balnazzarAI(Creature *c) : ScriptedAI(c) {} + + uint32 m_uiCrusadersHammer_Timer; + uint32 m_uiCrusaderStrike_Timer; + uint32 m_uiMindBlast_Timer; + uint32 m_uiHolyStrike_Timer; + uint32 m_uiShadowShock_Timer; + uint32 m_uiPsychicScream_Timer; + uint32 m_uiDeepSleep_Timer; + uint32 m_uiMindControl_Timer; + bool m_bTransformed; + + void Reset() { - //MindBlast - if (m_uiMindBlast_Timer <= uiDiff) - { - DoCast(me->getVictim(), SPELL_MINDBLAST); - m_uiMindBlast_Timer = 15000 + rand()%5000; - } else m_uiMindBlast_Timer -= uiDiff; - - //CrusadersHammer - if (m_uiCrusadersHammer_Timer <= uiDiff) - { - DoCast(me->getVictim(), SPELL_CRUSADERSHAMMER); - m_uiCrusadersHammer_Timer = 12000; - } else m_uiCrusadersHammer_Timer -= uiDiff; - - //CrusaderStrike - if (m_uiCrusaderStrike_Timer <= uiDiff) - { - DoCast(me->getVictim(), SPELL_CRUSADERSTRIKE); - m_uiCrusaderStrike_Timer = 15000; - } else m_uiCrusaderStrike_Timer -= uiDiff; - - //HolyStrike - if (m_uiHolyStrike_Timer <= uiDiff) - { - DoCast(me->getVictim(), SPELL_HOLYSTRIKE); - m_uiHolyStrike_Timer = 15000; - } else m_uiHolyStrike_Timer -= uiDiff; + m_uiCrusadersHammer_Timer = 8000; + m_uiCrusaderStrike_Timer = 12000; + m_uiMindBlast_Timer = 6000; + m_uiHolyStrike_Timer = 18000; + m_uiShadowShock_Timer = 4000; + m_uiPsychicScream_Timer = 16000; + m_uiDeepSleep_Timer = 20000; + m_uiMindControl_Timer = 10000; + m_bTransformed = false; + + if (me->GetEntry() == NPC_BALNAZZAR) + me->UpdateEntry(NPC_DATHROHAN); + } - //BalnazzarTransform - if (me->GetHealth()*100 / me->GetMaxHealth() < 40) - { - if (me->IsNonMeleeSpellCasted(false)) - me->InterruptNonMeleeSpells(false); + void JustDied(Unit* /*Victim*/) + { + static uint32 uiCount = sizeof(m_aSummonPoint)/sizeof(SummonDef); - //restore hp, mana and stun - DoCast(me, SPELL_BALNAZZARTRANSFORM); - me->UpdateEntry(NPC_BALNAZZAR); - m_bTransformed = true; - } + for (uint8 i=0; i<uiCount; ++i) + me->SummonCreature(NPC_ZOMBIE, + m_aSummonPoint[i].m_fX, m_aSummonPoint[i].m_fY, m_aSummonPoint[i].m_fZ, m_aSummonPoint[i].m_fOrient, + TEMPSUMMON_TIMED_DESPAWN, HOUR*IN_MILLISECONDS); } - else + + void EnterCombat(Unit * /*who*/) { - //MindBlast - if (m_uiMindBlast_Timer <= uiDiff) - { - DoCast(me->getVictim(), SPELL_MINDBLAST); - m_uiMindBlast_Timer = 15000 + rand()%5000; - } else m_uiMindBlast_Timer -= uiDiff; + } - //ShadowShock - if (m_uiShadowShock_Timer <= uiDiff) - { - DoCast(me->getVictim(), SPELL_SHADOWSHOCK); - m_uiShadowShock_Timer = 11000; - } else m_uiShadowShock_Timer -= uiDiff; + void UpdateAI(const uint32 uiDiff) + { + if (!UpdateVictim()) + return; - //PsychicScream - if (m_uiPsychicScream_Timer <= uiDiff) + //START NOT TRANSFORMED + if (!m_bTransformed) { - if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) - DoCast(pTarget, SPELL_PSYCHICSCREAM); - - m_uiPsychicScream_Timer = 20000; - } else m_uiPsychicScream_Timer -= uiDiff; - - //DeepSleep - if (m_uiDeepSleep_Timer <= uiDiff) + //MindBlast + if (m_uiMindBlast_Timer <= uiDiff) + { + DoCast(me->getVictim(), SPELL_MINDBLAST); + m_uiMindBlast_Timer = 15000 + rand()%5000; + } else m_uiMindBlast_Timer -= uiDiff; + + //CrusadersHammer + if (m_uiCrusadersHammer_Timer <= uiDiff) + { + DoCast(me->getVictim(), SPELL_CRUSADERSHAMMER); + m_uiCrusadersHammer_Timer = 12000; + } else m_uiCrusadersHammer_Timer -= uiDiff; + + //CrusaderStrike + if (m_uiCrusaderStrike_Timer <= uiDiff) + { + DoCast(me->getVictim(), SPELL_CRUSADERSTRIKE); + m_uiCrusaderStrike_Timer = 15000; + } else m_uiCrusaderStrike_Timer -= uiDiff; + + //HolyStrike + if (m_uiHolyStrike_Timer <= uiDiff) + { + DoCast(me->getVictim(), SPELL_HOLYSTRIKE); + m_uiHolyStrike_Timer = 15000; + } else m_uiHolyStrike_Timer -= uiDiff; + + //BalnazzarTransform + if (me->GetHealth()*100 / me->GetMaxHealth() < 40) + { + if (me->IsNonMeleeSpellCasted(false)) + me->InterruptNonMeleeSpells(false); + + //restore hp, mana and stun + DoCast(me, SPELL_BALNAZZARTRANSFORM); + me->UpdateEntry(NPC_BALNAZZAR); + m_bTransformed = true; + } + } + else { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) - DoCast(pTarget, SPELL_SLEEP); - - m_uiDeepSleep_Timer = 15000; - } else m_uiDeepSleep_Timer -= uiDiff; + //MindBlast + if (m_uiMindBlast_Timer <= uiDiff) + { + DoCast(me->getVictim(), SPELL_MINDBLAST); + m_uiMindBlast_Timer = 15000 + rand()%5000; + } else m_uiMindBlast_Timer -= uiDiff; + + //ShadowShock + if (m_uiShadowShock_Timer <= uiDiff) + { + DoCast(me->getVictim(), SPELL_SHADOWSHOCK); + m_uiShadowShock_Timer = 11000; + } else m_uiShadowShock_Timer -= uiDiff; + + //PsychicScream + if (m_uiPsychicScream_Timer <= uiDiff) + { + if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + DoCast(pTarget, SPELL_PSYCHICSCREAM); + + m_uiPsychicScream_Timer = 20000; + } else m_uiPsychicScream_Timer -= uiDiff; + + //DeepSleep + if (m_uiDeepSleep_Timer <= uiDiff) + { + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + DoCast(pTarget, SPELL_SLEEP); + + m_uiDeepSleep_Timer = 15000; + } else m_uiDeepSleep_Timer -= uiDiff; + + //MindControl + if (m_uiMindControl_Timer <= uiDiff) + { + DoCast(me->getVictim(), SPELL_MINDCONTROL); + m_uiMindControl_Timer = 15000; + } else m_uiMindControl_Timer -= uiDiff; + } - //MindControl - if (m_uiMindControl_Timer <= uiDiff) - { - DoCast(me->getVictim(), SPELL_MINDCONTROL); - m_uiMindControl_Timer = 15000; - } else m_uiMindControl_Timer -= uiDiff; + DoMeleeAttackIfReady(); } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_dathrohan_balnazzar(Creature* pCreature) -{ - return new boss_dathrohan_balnazzarAI (pCreature); -} void AddSC_boss_dathrohan_balnazzar() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_dathrohan_balnazzar"; - newscript->GetAI = &GetAI_boss_dathrohan_balnazzar; - newscript->RegisterSelf(); + new boss_dathrohan_balnazzar(); } - diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_magistrate_barthilas.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_magistrate_barthilas.cpp index 4551a8c5118..075117d9721 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/boss_magistrate_barthilas.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_magistrate_barthilas.cpp @@ -33,98 +33,100 @@ EndScriptData */ #define MODEL_NORMAL 10433 #define MODEL_HUMAN 3637 - -struct boss_magistrate_barthilasAI : public ScriptedAI +
class boss_magistrate_barthilas : public CreatureScript { - boss_magistrate_barthilasAI(Creature *c) : ScriptedAI(c) {} - - uint32 DrainingBlow_Timer; - uint32 CrowdPummel_Timer; - uint32 MightyBlow_Timer; - uint32 FuriousAnger_Timer; - uint32 AngerCount; +public: + boss_magistrate_barthilas() : CreatureScript("boss_magistrate_barthilas") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - DrainingBlow_Timer = 20000; - CrowdPummel_Timer = 15000; - MightyBlow_Timer = 10000; - FuriousAnger_Timer = 5000; - AngerCount = 0; - - if (me->isAlive()) - me->SetDisplayId(MODEL_NORMAL); - else - me->SetDisplayId(MODEL_HUMAN); + return new boss_magistrate_barthilasAI (pCreature); } - void MoveInLineOfSight(Unit *who) + struct boss_magistrate_barthilasAI : public ScriptedAI { - //nothing to see here yet + boss_magistrate_barthilasAI(Creature *c) : ScriptedAI(c) {} - ScriptedAI::MoveInLineOfSight(who); - } + uint32 DrainingBlow_Timer; + uint32 CrowdPummel_Timer; + uint32 MightyBlow_Timer; + uint32 FuriousAnger_Timer; + uint32 AngerCount; - void JustDied(Unit* /*Killer*/) - { - me->SetDisplayId(MODEL_HUMAN); - } + void Reset() + { + DrainingBlow_Timer = 20000; + CrowdPummel_Timer = 15000; + MightyBlow_Timer = 10000; + FuriousAnger_Timer = 5000; + AngerCount = 0; - void EnterCombat(Unit * /*who*/) - { - } + if (me->isAlive()) + me->SetDisplayId(MODEL_NORMAL); + else + me->SetDisplayId(MODEL_HUMAN); + } - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - if (FuriousAnger_Timer <= diff) + void MoveInLineOfSight(Unit *who) { - FuriousAnger_Timer = 4000; - if (AngerCount > 25) - return; + //nothing to see here yet - ++AngerCount; - DoCast(me, SPELL_FURIOUS_ANGER, false); - } else FuriousAnger_Timer -= diff; + ScriptedAI::MoveInLineOfSight(who); + } - //DrainingBlow - if (DrainingBlow_Timer <= diff) + void JustDied(Unit* /*Killer*/) { - DoCast(me->getVictim(), SPELL_DRAININGBLOW); - DrainingBlow_Timer = 15000; - } else DrainingBlow_Timer -= diff; + me->SetDisplayId(MODEL_HUMAN); + } - //CrowdPummel - if (CrowdPummel_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - DoCast(me->getVictim(), SPELL_CROWDPUMMEL); - CrowdPummel_Timer = 15000; - } else CrowdPummel_Timer -= diff; + } - //MightyBlow - if (MightyBlow_Timer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_MIGHTYBLOW); - MightyBlow_Timer = 20000; - } else MightyBlow_Timer -= diff; + //Return since we have no target + if (!UpdateVictim()) + return; + + if (FuriousAnger_Timer <= diff) + { + FuriousAnger_Timer = 4000; + if (AngerCount > 25) + return; + + ++AngerCount; + DoCast(me, SPELL_FURIOUS_ANGER, false); + } else FuriousAnger_Timer -= diff; + + //DrainingBlow + if (DrainingBlow_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_DRAININGBLOW); + DrainingBlow_Timer = 15000; + } else DrainingBlow_Timer -= diff; + + //CrowdPummel + if (CrowdPummel_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_CROWDPUMMEL); + CrowdPummel_Timer = 15000; + } else CrowdPummel_Timer -= diff; + + //MightyBlow + if (MightyBlow_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_MIGHTYBLOW); + MightyBlow_Timer = 20000; + } else MightyBlow_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_magistrate_barthilas(Creature* pCreature) -{ - return new boss_magistrate_barthilasAI (pCreature); -} void AddSC_boss_magistrate_barthilas() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_magistrate_barthilas"; - newscript->GetAI = &GetAI_boss_magistrate_barthilas; - newscript->RegisterSelf(); + new boss_magistrate_barthilas(); } - diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_maleki_the_pallid.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_maleki_the_pallid.cpp index f47da709578..e65694baaec 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/boss_maleki_the_pallid.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_maleki_the_pallid.cpp @@ -30,81 +30,83 @@ EndScriptData */ #define SPELL_DRAINLIFE 20743 #define SPELL_DRAIN_MANA 17243 #define SPELL_ICETOMB 16869 - -struct boss_maleki_the_pallidAI : public ScriptedAI +
class boss_maleki_the_pallid : public CreatureScript { - boss_maleki_the_pallidAI(Creature *c) : ScriptedAI(c) - { - pInstance = me->GetInstanceData(); - } - - ScriptedInstance* pInstance; - - uint32 Frostbolt_Timer; - uint32 IceTomb_Timer; - uint32 DrainLife_Timer; +public: + boss_maleki_the_pallid() : CreatureScript("boss_maleki_the_pallid") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - Frostbolt_Timer = 1000; - IceTomb_Timer = 16000; - DrainLife_Timer = 31000; + return new boss_maleki_the_pallidAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_maleki_the_pallidAI : public ScriptedAI { - } + boss_maleki_the_pallidAI(Creature *c) : ScriptedAI(c) + { + pInstance = me->GetInstanceScript(); + } - void JustDied(Unit* /*Killer*/) - { - if (pInstance) - pInstance->SetData(TYPE_PALLID,IN_PROGRESS); - } + InstanceScript* pInstance; - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + uint32 Frostbolt_Timer; + uint32 IceTomb_Timer; + uint32 DrainLife_Timer; - //Frostbolt - if (Frostbolt_Timer <= diff) + void Reset() { - if (rand()%100 < 90) - DoCast(me->getVictim(), SPELL_FROSTBOLT); - Frostbolt_Timer = 3500; - } else Frostbolt_Timer -= diff; + Frostbolt_Timer = 1000; + IceTomb_Timer = 16000; + DrainLife_Timer = 31000; + } - //IceTomb - if (IceTomb_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - if (rand()%100 < 65) - DoCast(me->getVictim(), SPELL_ICETOMB); - IceTomb_Timer = 28000; - } else IceTomb_Timer -= diff; + } - //DrainLife - if (DrainLife_Timer <= diff) + void JustDied(Unit* /*Killer*/) { - if (rand()%100 < 55) - DoCast(me->getVictim(), SPELL_DRAINLIFE); - DrainLife_Timer = 31000; - } else DrainLife_Timer -= diff; + if (pInstance) + pInstance->SetData(TYPE_PALLID,IN_PROGRESS); + } + + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + //Frostbolt + if (Frostbolt_Timer <= diff) + { + if (rand()%100 < 90) + DoCast(me->getVictim(), SPELL_FROSTBOLT); + Frostbolt_Timer = 3500; + } else Frostbolt_Timer -= diff; + + //IceTomb + if (IceTomb_Timer <= diff) + { + if (rand()%100 < 65) + DoCast(me->getVictim(), SPELL_ICETOMB); + IceTomb_Timer = 28000; + } else IceTomb_Timer -= diff; + + //DrainLife + if (DrainLife_Timer <= diff) + { + if (rand()%100 < 55) + DoCast(me->getVictim(), SPELL_DRAINLIFE); + DrainLife_Timer = 31000; + } else DrainLife_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_maleki_the_pallid(Creature* pCreature) -{ - return new boss_maleki_the_pallidAI (pCreature); -} void AddSC_boss_maleki_the_pallid() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_maleki_the_pallid"; - newscript->GetAI = &GetAI_boss_maleki_the_pallid; - newscript->RegisterSelf(); + new boss_maleki_the_pallid(); } - diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_nerubenkan.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_nerubenkan.cpp index 1e39e4ef3e4..19cb00172b8 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/boss_nerubenkan.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_nerubenkan.cpp @@ -30,94 +30,96 @@ EndScriptData */ #define SPELL_PIERCEARMOR 6016 #define SPELL_CRYPT_SCARABS 31602 #define SPELL_RAISEUNDEADSCARAB 17235 - -struct boss_nerubenkanAI : public ScriptedAI +
class boss_nerubenkan : public CreatureScript { - boss_nerubenkanAI(Creature *c) : ScriptedAI(c) - { - pInstance = me->GetInstanceData(); - } - - ScriptedInstance* pInstance; - - uint32 EncasingWebs_Timer; - uint32 PierceArmor_Timer; - uint32 CryptScarabs_Timer; - uint32 RaiseUndeadScarab_Timer; +public: + boss_nerubenkan() : CreatureScript("boss_nerubenkan") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - CryptScarabs_Timer = 3000; - EncasingWebs_Timer = 7000; - PierceArmor_Timer = 19000; - RaiseUndeadScarab_Timer = 3000; + return new boss_nerubenkanAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_nerubenkanAI : public ScriptedAI { - } + boss_nerubenkanAI(Creature *c) : ScriptedAI(c) + { + pInstance = me->GetInstanceScript(); + } - void JustDied(Unit* /*Killer*/) - { - if (pInstance) - pInstance->SetData(TYPE_NERUB,IN_PROGRESS); - } + InstanceScript* pInstance; - void RaiseUndeadScarab(Unit* pVictim) - { - if (Creature* pUndeadScarab = DoSpawnCreature(10876, irand(-9,9), irand(-9,9), 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 180000)) - if (pUndeadScarab->AI()) - pUndeadScarab->AI()->AttackStart(pVictim); - } + uint32 EncasingWebs_Timer; + uint32 PierceArmor_Timer; + uint32 CryptScarabs_Timer; + uint32 RaiseUndeadScarab_Timer; - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + void Reset() + { + CryptScarabs_Timer = 3000; + EncasingWebs_Timer = 7000; + PierceArmor_Timer = 19000; + RaiseUndeadScarab_Timer = 3000; + } - //EncasingWebs - if (EncasingWebs_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - DoCast(me->getVictim(), SPELL_ENCASINGWEBS); - EncasingWebs_Timer = 30000; - } else EncasingWebs_Timer -= diff; + } - //PierceArmor - if (PierceArmor_Timer <= diff) + void JustDied(Unit* /*Killer*/) { - if (urand(0,3) < 2) - DoCast(me->getVictim(), SPELL_PIERCEARMOR); - PierceArmor_Timer = 35000; - } else PierceArmor_Timer -= diff; + if (pInstance) + pInstance->SetData(TYPE_NERUB,IN_PROGRESS); + } - //CryptScarabs_Timer - if (CryptScarabs_Timer <= diff) + void RaiseUndeadScarab(Unit* pVictim) { - DoCast(me->getVictim(), SPELL_CRYPT_SCARABS); - CryptScarabs_Timer = 20000; - } else CryptScarabs_Timer -= diff; + if (Creature* pUndeadScarab = DoSpawnCreature(10876, irand(-9,9), irand(-9,9), 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 180000)) + if (pUndeadScarab->AI()) + pUndeadScarab->AI()->AttackStart(pVictim); + } - //RaiseUndeadScarab - if (RaiseUndeadScarab_Timer <= diff) + void UpdateAI(const uint32 diff) { - RaiseUndeadScarab(me->getVictim()); - RaiseUndeadScarab_Timer = 16000; - } else RaiseUndeadScarab_Timer -= diff; + if (!UpdateVictim()) + return; + + //EncasingWebs + if (EncasingWebs_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_ENCASINGWEBS); + EncasingWebs_Timer = 30000; + } else EncasingWebs_Timer -= diff; + + //PierceArmor + if (PierceArmor_Timer <= diff) + { + if (urand(0,3) < 2) + DoCast(me->getVictim(), SPELL_PIERCEARMOR); + PierceArmor_Timer = 35000; + } else PierceArmor_Timer -= diff; + + //CryptScarabs_Timer + if (CryptScarabs_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_CRYPT_SCARABS); + CryptScarabs_Timer = 20000; + } else CryptScarabs_Timer -= diff; + + //RaiseUndeadScarab + if (RaiseUndeadScarab_Timer <= diff) + { + RaiseUndeadScarab(me->getVictim()); + RaiseUndeadScarab_Timer = 16000; + } else RaiseUndeadScarab_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_nerubenkan(Creature* pCreature) -{ - return new boss_nerubenkanAI (pCreature); -} void AddSC_boss_nerubenkan() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_nerubenkan"; - newscript->GetAI = &GetAI_boss_nerubenkan; - newscript->RegisterSelf(); + new boss_nerubenkan(); } - diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_order_of_silver_hand.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_order_of_silver_hand.cpp index c20ac90aae0..6e4eb25fb12 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/boss_order_of_silver_hand.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_order_of_silver_hand.cpp @@ -42,118 +42,117 @@ EndScriptData */ #define SPELL_HOLY_LIGHT 25263 #define SPELL_DIVINE_SHIELD 13874 - -struct boss_silver_hand_bossesAI : public ScriptedAI +class boss_silver_hand_bosses : public CreatureScript { - boss_silver_hand_bossesAI(Creature* c) : ScriptedAI(c) +public: + boss_silver_hand_bosses() : CreatureScript("boss_silver_hand_bosses") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_silver_hand_bossesAI (pCreature); } - ScriptedInstance *pInstance; - - uint32 HolyLight_Timer; - uint32 DivineShield_Timer; - - void Reset() + struct boss_silver_hand_bossesAI : public ScriptedAI { - HolyLight_Timer = 20000; - DivineShield_Timer = 20000; - - if (pInstance) + boss_silver_hand_bossesAI(Creature* c) : ScriptedAI(c) { - switch(me->GetEntry()) - { - case SH_AELMAR: - pInstance->SetData(TYPE_SH_AELMAR, 0); - break; - case SH_CATHELA: - pInstance->SetData(TYPE_SH_CATHELA, 0); - break; - case SH_GREGOR: - pInstance->SetData(TYPE_SH_GREGOR, 0); - break; - case SH_NEMAS: - pInstance->SetData(TYPE_SH_NEMAS, 0); - break; - case SH_VICAR: - pInstance->SetData(TYPE_SH_VICAR, 0); - break; - } + pInstance = c->GetInstanceScript(); } - } - void EnterCombat(Unit* /*who*/) - { - } + InstanceScript *pInstance; - void JustDied(Unit* Killer) - { - if (pInstance) + uint32 HolyLight_Timer; + uint32 DivineShield_Timer; + + void Reset() { - switch(me->GetEntry()) + HolyLight_Timer = 20000; + DivineShield_Timer = 20000; + + if (pInstance) { - case SH_AELMAR: - pInstance->SetData(TYPE_SH_AELMAR, 2); - break; - case SH_CATHELA: - pInstance->SetData(TYPE_SH_CATHELA, 2); - break; - case SH_GREGOR: - pInstance->SetData(TYPE_SH_GREGOR, 2); - break; - case SH_NEMAS: - pInstance->SetData(TYPE_SH_NEMAS, 2); - break; - case SH_VICAR: - pInstance->SetData(TYPE_SH_VICAR, 2); - break; + switch(me->GetEntry()) + { + case SH_AELMAR: + pInstance->SetData(TYPE_SH_AELMAR, 0); + break; + case SH_CATHELA: + pInstance->SetData(TYPE_SH_CATHELA, 0); + break; + case SH_GREGOR: + pInstance->SetData(TYPE_SH_GREGOR, 0); + break; + case SH_NEMAS: + pInstance->SetData(TYPE_SH_NEMAS, 0); + break; + case SH_VICAR: + pInstance->SetData(TYPE_SH_VICAR, 0); + break; + } } - if (pInstance->GetData(TYPE_SH_QUEST) && Killer->GetTypeId() == TYPEID_PLAYER) - CAST_PLR(Killer)->KilledMonsterCredit(SH_QUEST_CREDIT,me->GetGUID()); } - } - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - if (HolyLight_Timer <= diff) + void EnterCombat(Unit* /*who*/) { - if (me->GetHealth()*5 < me->GetMaxHealth()) - { - DoCast(me, SPELL_HOLY_LIGHT); - HolyLight_Timer = 20000; - } - } else HolyLight_Timer -= diff; + } - if (DivineShield_Timer <= diff) + void JustDied(Unit* Killer) { - if (me->GetHealth()*20 < me->GetMaxHealth()) + if (pInstance) { - DoCast(me, SPELL_DIVINE_SHIELD); - DivineShield_Timer = 40000; + switch(me->GetEntry()) + { + case SH_AELMAR: + pInstance->SetData(TYPE_SH_AELMAR, 2); + break; + case SH_CATHELA: + pInstance->SetData(TYPE_SH_CATHELA, 2); + break; + case SH_GREGOR: + pInstance->SetData(TYPE_SH_GREGOR, 2); + break; + case SH_NEMAS: + pInstance->SetData(TYPE_SH_NEMAS, 2); + break; + case SH_VICAR: + pInstance->SetData(TYPE_SH_VICAR, 2); + break; + } + if (pInstance->GetData(TYPE_SH_QUEST) && Killer->GetTypeId() == TYPEID_PLAYER) + CAST_PLR(Killer)->KilledMonsterCredit(SH_QUEST_CREDIT,me->GetGUID()); } - } else DivineShield_Timer -= diff; + } - DoMeleeAttackIfReady(); - } + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + if (HolyLight_Timer <= diff) + { + if (me->GetHealth()*5 < me->GetMaxHealth()) + { + DoCast(me, SPELL_HOLY_LIGHT); + HolyLight_Timer = 20000; + } + } else HolyLight_Timer -= diff; + + if (DivineShield_Timer <= diff) + { + if (me->GetHealth()*20 < me->GetMaxHealth()) + { + DoCast(me, SPELL_DIVINE_SHIELD); + DivineShield_Timer = 40000; + } + } else DivineShield_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; }; -CreatureAI* GetAI_boss_silver_hand_bossesAI(Creature* pCreature) -{ - return new boss_silver_hand_bossesAI (pCreature); -} void AddSC_boss_order_of_silver_hand() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_silver_hand_bosses"; - newscript->GetAI = &GetAI_boss_silver_hand_bossesAI; - newscript->RegisterSelf(); + new boss_silver_hand_bosses(); } - diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_postmaster_malown.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_postmaster_malown.cpp index 002cd963e2a..26934d10137 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/boss_postmaster_malown.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_postmaster_malown.cpp @@ -35,112 +35,114 @@ EndScriptData */ #define SPELL_CURSEOFWEAKNESS 8552 #define SPELL_CURSEOFTONGUES 12889 #define SPELL_CALLOFTHEGRAVE 17831 - -struct boss_postmaster_malownAI : public ScriptedAI +
class boss_postmaster_malown : public CreatureScript { - boss_postmaster_malownAI(Creature *c) : ScriptedAI(c) {} - - uint32 WailingDead_Timer; - uint32 Backhand_Timer; - uint32 CurseOfWeakness_Timer; - uint32 CurseOfTongues_Timer; - uint32 CallOfTheGrave_Timer; - bool HasYelled; +public: + boss_postmaster_malown() : CreatureScript("boss_postmaster_malown") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - WailingDead_Timer = 19000; //lasts 6 sec - Backhand_Timer = 8000; //2 sec stun - CurseOfWeakness_Timer = 20000; //lasts 2 mins - CurseOfTongues_Timer = 22000; - CallOfTheGrave_Timer = 25000; - HasYelled = false; + return new boss_postmaster_malownAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_postmaster_malownAI : public ScriptedAI { - } + boss_postmaster_malownAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + uint32 WailingDead_Timer; + uint32 Backhand_Timer; + uint32 CurseOfWeakness_Timer; + uint32 CurseOfTongues_Timer; + uint32 CallOfTheGrave_Timer; + bool HasYelled; - //WailingDead - if (WailingDead_Timer <= diff) + void Reset() { - //Cast - if (rand()%100 < 65) //65% chance to cast - { - DoCast(me->getVictim(), SPELL_WAILINGDEAD); - } - //19 seconds until we should cast this again - WailingDead_Timer = 19000; - } else WailingDead_Timer -= diff; - - //Backhand - if (Backhand_Timer <= diff) + WailingDead_Timer = 19000; //lasts 6 sec + Backhand_Timer = 8000; //2 sec stun + CurseOfWeakness_Timer = 20000; //lasts 2 mins + CurseOfTongues_Timer = 22000; + CallOfTheGrave_Timer = 25000; + HasYelled = false; + } + + void EnterCombat(Unit * /*who*/) { - //Cast - if (rand()%100 < 45) //45% chance to cast - { - DoCast(me->getVictim(), SPELL_BACKHAND); - } - //8 seconds until we should cast this again - Backhand_Timer = 8000; - } else Backhand_Timer -= diff; - - //CurseOfWeakness - if (CurseOfWeakness_Timer <= diff) + } + + void UpdateAI(const uint32 diff) { - //Cast - if (rand()%100 < 3) //3% chance to cast + //Return since we have no target + if (!UpdateVictim()) + return; + + //WailingDead + if (WailingDead_Timer <= diff) { - DoCast(me->getVictim(), SPELL_CURSEOFWEAKNESS); - } - //20 seconds until we should cast this again - CurseOfWeakness_Timer = 20000; - } else CurseOfWeakness_Timer -= diff; - - //CurseOfTongues - if (CurseOfTongues_Timer <= diff) - { - //Cast - if (rand()%100 < 3) //3% chance to cast + //Cast + if (rand()%100 < 65) //65% chance to cast + { + DoCast(me->getVictim(), SPELL_WAILINGDEAD); + } + //19 seconds until we should cast this again + WailingDead_Timer = 19000; + } else WailingDead_Timer -= diff; + + //Backhand + if (Backhand_Timer <= diff) { - DoCast(me->getVictim(), SPELL_CURSEOFTONGUES); - } - //22 seconds until we should cast this again - CurseOfTongues_Timer = 22000; - } else CurseOfTongues_Timer -= diff; - - //CallOfTheGrave - if (CallOfTheGrave_Timer <= diff) - { - //Cast - if (rand()%100 < 5) //5% chance to cast + //Cast + if (rand()%100 < 45) //45% chance to cast + { + DoCast(me->getVictim(), SPELL_BACKHAND); + } + //8 seconds until we should cast this again + Backhand_Timer = 8000; + } else Backhand_Timer -= diff; + + //CurseOfWeakness + if (CurseOfWeakness_Timer <= diff) { - DoCast(me->getVictim(), SPELL_CALLOFTHEGRAVE); - } - //25 seconds until we should cast this again - CallOfTheGrave_Timer = 25000; - } else CallOfTheGrave_Timer -= diff; + //Cast + if (rand()%100 < 3) //3% chance to cast + { + DoCast(me->getVictim(), SPELL_CURSEOFWEAKNESS); + } + //20 seconds until we should cast this again + CurseOfWeakness_Timer = 20000; + } else CurseOfWeakness_Timer -= diff; + + //CurseOfTongues + if (CurseOfTongues_Timer <= diff) + { + //Cast + if (rand()%100 < 3) //3% chance to cast + { + DoCast(me->getVictim(), SPELL_CURSEOFTONGUES); + } + //22 seconds until we should cast this again + CurseOfTongues_Timer = 22000; + } else CurseOfTongues_Timer -= diff; + + //CallOfTheGrave + if (CallOfTheGrave_Timer <= diff) + { + //Cast + if (rand()%100 < 5) //5% chance to cast + { + DoCast(me->getVictim(), SPELL_CALLOFTHEGRAVE); + } + //25 seconds until we should cast this again + CallOfTheGrave_Timer = 25000; + } else CallOfTheGrave_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_postmaster_malown(Creature* pCreature) -{ - return new boss_postmaster_malownAI (pCreature); -} void AddSC_boss_postmaster_malown() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_postmaster_malown"; - newscript->GetAI = &GetAI_boss_postmaster_malown; - newscript->RegisterSelf(); + new boss_postmaster_malown(); } - diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_ramstein_the_gorger.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_ramstein_the_gorger.cpp index 809b62e68af..62ab92965b3 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/boss_ramstein_the_gorger.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_ramstein_the_gorger.cpp @@ -30,75 +30,77 @@ EndScriptData */ #define SPELL_KNOCKOUT 17307 #define C_MINDLESS_UNDEAD 11030 - -struct boss_ramstein_the_gorgerAI : public ScriptedAI +
class boss_ramstein_the_gorger : public CreatureScript { - boss_ramstein_the_gorgerAI(Creature *c) : ScriptedAI(c) - { - pInstance = me->GetInstanceData(); - } +public: + boss_ramstein_the_gorger() : CreatureScript("boss_ramstein_the_gorger") { } - ScriptedInstance* pInstance; - - uint32 Trample_Timer; - uint32 Knockout_Timer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - Trample_Timer = 3000; - Knockout_Timer = 12000; + return new boss_ramstein_the_gorgerAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_ramstein_the_gorgerAI : public ScriptedAI { - } - - void JustDied(Unit* /*Killer*/) - { - for (uint8 i = 0; i < 30; ++i) + boss_ramstein_the_gorgerAI(Creature *c) : ScriptedAI(c) { - if (Creature* mob = me->SummonCreature(C_MINDLESS_UNDEAD,3969.35+irand(-10,10),-3391.87+irand(-10,10),119.11,5.91,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,1800000)) - mob->AI()->AttackStart(me->SelectNearestTarget(500)); + pInstance = me->GetInstanceScript(); } - if (pInstance) - pInstance->SetData(TYPE_RAMSTEIN,DONE); - } + InstanceScript* pInstance; - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + uint32 Trample_Timer; + uint32 Knockout_Timer; + + void Reset() + { + Trample_Timer = 3000; + Knockout_Timer = 12000; + } - //Trample - if (Trample_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - DoCast(me, SPELL_TRAMPLE); - Trample_Timer = 7000; - } else Trample_Timer -= diff; + } - //Knockout - if (Knockout_Timer <= diff) + void JustDied(Unit* /*Killer*/) { - DoCast(me->getVictim(), SPELL_KNOCKOUT); - Knockout_Timer = 10000; - } else Knockout_Timer -= diff; + for (uint8 i = 0; i < 30; ++i) + { + if (Creature* mob = me->SummonCreature(C_MINDLESS_UNDEAD,3969.35+irand(-10,10),-3391.87+irand(-10,10),119.11,5.91,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,1800000)) + mob->AI()->AttackStart(me->SelectNearestTarget(500)); + } + + if (pInstance) + pInstance->SetData(TYPE_RAMSTEIN,DONE); + } + + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + //Trample + if (Trample_Timer <= diff) + { + DoCast(me, SPELL_TRAMPLE); + Trample_Timer = 7000; + } else Trample_Timer -= diff; + + //Knockout + if (Knockout_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_KNOCKOUT); + Knockout_Timer = 10000; + } else Knockout_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_ramstein_the_gorger(Creature* pCreature) -{ - return new boss_ramstein_the_gorgerAI (pCreature); -} void AddSC_boss_ramstein_the_gorger() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_ramstein_the_gorger"; - newscript->GetAI = &GetAI_boss_ramstein_the_gorger; - newscript->RegisterSelf(); + new boss_ramstein_the_gorger(); } - diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_timmy_the_cruel.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_timmy_the_cruel.cpp index 426e40e2db2..751fec2de38 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/boss_timmy_the_cruel.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_timmy_the_cruel.cpp @@ -28,58 +28,60 @@ EndScriptData */ #define SAY_SPAWN "TIMMY!" #define SPELL_RAVENOUSCLAW 17470 - -struct boss_timmy_the_cruelAI : public ScriptedAI +
class boss_timmy_the_cruel : public CreatureScript { - boss_timmy_the_cruelAI(Creature *c) : ScriptedAI(c) {} - - uint32 RavenousClaw_Timer; - bool HasYelled; +public: + boss_timmy_the_cruel() : CreatureScript("boss_timmy_the_cruel") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - RavenousClaw_Timer = 10000; - HasYelled = false; + return new boss_timmy_the_cruelAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_timmy_the_cruelAI : public ScriptedAI { - if (!HasYelled) + boss_timmy_the_cruelAI(Creature *c) : ScriptedAI(c) {} + + uint32 RavenousClaw_Timer; + bool HasYelled; + + void Reset() { - me->MonsterYell(SAY_SPAWN,LANG_UNIVERSAL,NULL); - HasYelled = true; + RavenousClaw_Timer = 10000; + HasYelled = false; } - } - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + void EnterCombat(Unit * /*who*/) + { + if (!HasYelled) + { + me->MonsterYell(SAY_SPAWN,LANG_UNIVERSAL,NULL); + HasYelled = true; + } + } - //RavenousClaw - if (RavenousClaw_Timer <= diff) + void UpdateAI(const uint32 diff) { - //Cast - DoCast(me->getVictim(), SPELL_RAVENOUSCLAW); - //15 seconds until we should cast this again - RavenousClaw_Timer = 15000; - } else RavenousClaw_Timer -= diff; + //Return since we have no target + if (!UpdateVictim()) + return; + + //RavenousClaw + if (RavenousClaw_Timer <= diff) + { + //Cast + DoCast(me->getVictim(), SPELL_RAVENOUSCLAW); + //15 seconds until we should cast this again + RavenousClaw_Timer = 15000; + } else RavenousClaw_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_timmy_the_cruel(Creature* pCreature) -{ - return new boss_timmy_the_cruelAI (pCreature); -} void AddSC_boss_timmy_the_cruel() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_timmy_the_cruel"; - newscript->GetAI = &GetAI_boss_timmy_the_cruel; - newscript->RegisterSelf(); + new boss_timmy_the_cruel(); } - diff --git a/src/server/scripts/EasternKingdoms/Stratholme/instance_stratholme.cpp b/src/server/scripts/EasternKingdoms/Stratholme/instance_stratholme.cpp index 797a3899806..1baae222285 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/instance_stratholme.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/instance_stratholme.cpp @@ -48,413 +48,415 @@ EndScriptData */ #define C_YSIDA 16031 #define MAX_ENCOUNTER 6 - -struct instance_stratholme : public ScriptedInstance +
class instance_stratholme : public InstanceMapScript { - instance_stratholme(Map* pMap) : ScriptedInstance(pMap) {} +public: + instance_stratholme() : InstanceMapScript("instance_stratholme") { } + + InstanceScript* GetInstanceData_InstanceMapScript(Map* pMap) + { + return new instance_stratholme_InstanceMapScript(pMap); + } - uint32 Encounter[MAX_ENCOUNTER]; + struct instance_stratholme_InstanceMapScript : public InstanceScript + { + instance_stratholme_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {} - bool IsSilverHandDead[5]; + uint32 Encounter[MAX_ENCOUNTER]; - uint32 BaronRun_Timer; - uint32 SlaugtherSquare_Timer; + bool IsSilverHandDead[5]; - uint64 serviceEntranceGUID; - uint64 gauntletGate1GUID; - uint64 ziggurat1GUID; - uint64 ziggurat2GUID; - uint64 ziggurat3GUID; - uint64 ziggurat4GUID; - uint64 ziggurat5GUID; - uint64 portGauntletGUID; - uint64 portSlaugtherGUID; - uint64 portElderGUID; + uint32 BaronRun_Timer; + uint32 SlaugtherSquare_Timer; - uint64 baronGUID; - uint64 ysidaTriggerGUID; - std::set<uint64> crystalsGUID; - std::set<uint64> abomnationGUID; + uint64 serviceEntranceGUID; + uint64 gauntletGate1GUID; + uint64 ziggurat1GUID; + uint64 ziggurat2GUID; + uint64 ziggurat3GUID; + uint64 ziggurat4GUID; + uint64 ziggurat5GUID; + uint64 portGauntletGUID; + uint64 portSlaugtherGUID; + uint64 portElderGUID; - void Initialize() - { - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - Encounter[i] = NOT_STARTED; - - for (uint8 i = 0; i < 5; ++i) - IsSilverHandDead[i] = false; - - BaronRun_Timer = 0; - SlaugtherSquare_Timer = 0; - - serviceEntranceGUID = 0; - gauntletGate1GUID = 0; - ziggurat1GUID = 0; - ziggurat2GUID = 0; - ziggurat3GUID = 0; - ziggurat4GUID = 0; - ziggurat5GUID = 0; - portGauntletGUID = 0; - portSlaugtherGUID = 0; - portElderGUID = 0; - - baronGUID = 0; - ysidaTriggerGUID = 0; - crystalsGUID.clear(); - abomnationGUID.clear(); - } + uint64 baronGUID; + uint64 ysidaTriggerGUID; + std::set<uint64> crystalsGUID; + std::set<uint64> abomnationGUID; - bool StartSlaugtherSquare() - { - //change to DONE when crystals implemented - if (Encounter[1] == IN_PROGRESS && Encounter[2] == IN_PROGRESS && Encounter[3] == IN_PROGRESS) + void Initialize() { - HandleGameObject(portGauntletGUID, true); - HandleGameObject(portSlaugtherGUID, true); - return true; + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + Encounter[i] = NOT_STARTED; + + for (uint8 i = 0; i < 5; ++i) + IsSilverHandDead[i] = false; + + BaronRun_Timer = 0; + SlaugtherSquare_Timer = 0; + + serviceEntranceGUID = 0; + gauntletGate1GUID = 0; + ziggurat1GUID = 0; + ziggurat2GUID = 0; + ziggurat3GUID = 0; + ziggurat4GUID = 0; + ziggurat5GUID = 0; + portGauntletGUID = 0; + portSlaugtherGUID = 0; + portElderGUID = 0; + + baronGUID = 0; + ysidaTriggerGUID = 0; + crystalsGUID.clear(); + abomnationGUID.clear(); } - sLog.outDebug("TSCR: Instance Stratholme: Cannot open slaugther square yet."); - return false; - } + bool StartSlaugtherSquare() + { + //change to DONE when crystals implemented + if (Encounter[1] == IN_PROGRESS && Encounter[2] == IN_PROGRESS && Encounter[3] == IN_PROGRESS) + { + HandleGameObject(portGauntletGUID, true); + HandleGameObject(portSlaugtherGUID, true); + return true; + } - //if withRestoreTime true, then newState will be ignored and GO should be restored to original state after 10 seconds - void UpdateGoState(uint64 goGuid, uint32 newState, bool withRestoreTime) - { - if (!goGuid) - return; + sLog.outDebug("TSCR: Instance Stratholme: Cannot open slaugther square yet."); + return false; + } - if (GameObject* pGo = instance->GetGameObject(goGuid)) + //if withRestoreTime true, then newState will be ignored and GO should be restored to original state after 10 seconds + void UpdateGoState(uint64 goGuid, uint32 newState, bool withRestoreTime) { - if (withRestoreTime) - pGo->UseDoorOrButton(10); - else - pGo->SetGoState((GOState)newState); + if (!goGuid) + return; + + if (GameObject* pGo = instance->GetGameObject(goGuid)) + { + if (withRestoreTime) + pGo->UseDoorOrButton(10); + else + pGo->SetGoState((GOState)newState); + } } - } - void OnCreatureCreate(Creature* pCreature, bool /*add*/) - { - switch(pCreature->GetEntry()) + void OnCreatureCreate(Creature* pCreature, bool /*add*/) { - case C_BARON: baronGUID = pCreature->GetGUID(); break; - case C_YSIDA_TRIGGER: ysidaTriggerGUID = pCreature->GetGUID(); break; - case C_CRYSTAL: crystalsGUID.insert(pCreature->GetGUID()); break; - case C_ABOM_BILE: - case C_ABOM_VENOM: abomnationGUID.insert(pCreature->GetGUID()); break; + switch(pCreature->GetEntry()) + { + case C_BARON: baronGUID = pCreature->GetGUID(); break; + case C_YSIDA_TRIGGER: ysidaTriggerGUID = pCreature->GetGUID(); break; + case C_CRYSTAL: crystalsGUID.insert(pCreature->GetGUID()); break; + case C_ABOM_BILE: + case C_ABOM_VENOM: abomnationGUID.insert(pCreature->GetGUID()); break; + } } - } - void OnGameObjectCreate(GameObject* pGo, bool /*add*/) - { - switch(pGo->GetEntry()) + void OnGameObjectCreate(GameObject* pGo, bool /*add*/) { - case GO_SERVICE_ENTRANCE: - serviceEntranceGUID = pGo->GetGUID(); - break; - case GO_GAUNTLET_GATE1: - //weird, but unless flag is set, client will not respond as expected. DB bug? - pGo->SetFlag(GAMEOBJECT_FLAGS,GO_FLAG_LOCKED); - gauntletGate1GUID = pGo->GetGUID(); - break; - case GO_ZIGGURAT1: - ziggurat1GUID = pGo->GetGUID(); - if (GetData(TYPE_BARONESS) == IN_PROGRESS) - HandleGameObject(0, true, pGo); - break; - case GO_ZIGGURAT2: - ziggurat2GUID = pGo->GetGUID(); - if (GetData(TYPE_NERUB) == IN_PROGRESS) - HandleGameObject(0, true, pGo); - break; - case GO_ZIGGURAT3: - ziggurat3GUID = pGo->GetGUID(); - if (GetData(TYPE_PALLID) == IN_PROGRESS) - HandleGameObject(0, true, pGo); - break; - case GO_ZIGGURAT4: - ziggurat4GUID = pGo->GetGUID(); - if (GetData(TYPE_BARON) == DONE || GetData(TYPE_RAMSTEIN) == DONE) - HandleGameObject(0, true, pGo); - break; - case GO_ZIGGURAT5: - ziggurat5GUID = pGo->GetGUID(); - if (GetData(TYPE_BARON) == DONE || GetData(TYPE_RAMSTEIN) == DONE) - HandleGameObject(0, true, pGo); - break; - case GO_PORT_GAUNTLET: - portGauntletGUID = pGo->GetGUID(); - if (GetData(TYPE_BARONESS) == IN_PROGRESS && GetData(TYPE_NERUB) == IN_PROGRESS && GetData(TYPE_PALLID) == IN_PROGRESS) - HandleGameObject(0, true, pGo); - break; - case GO_PORT_SLAUGTHER: - portSlaugtherGUID = pGo->GetGUID(); - if (GetData(TYPE_BARONESS) == IN_PROGRESS && GetData(TYPE_NERUB) == IN_PROGRESS && GetData(TYPE_PALLID) == IN_PROGRESS) - HandleGameObject(0, true, pGo); - break; - case GO_PORT_ELDERS: - portElderGUID = pGo->GetGUID(); - break; + switch(pGo->GetEntry()) + { + case GO_SERVICE_ENTRANCE: + serviceEntranceGUID = pGo->GetGUID(); + break; + case GO_GAUNTLET_GATE1: + //weird, but unless flag is set, client will not respond as expected. DB bug? + pGo->SetFlag(GAMEOBJECT_FLAGS,GO_FLAG_LOCKED); + gauntletGate1GUID = pGo->GetGUID(); + break; + case GO_ZIGGURAT1: + ziggurat1GUID = pGo->GetGUID(); + if (GetData(TYPE_BARONESS) == IN_PROGRESS) + HandleGameObject(0, true, pGo); + break; + case GO_ZIGGURAT2: + ziggurat2GUID = pGo->GetGUID(); + if (GetData(TYPE_NERUB) == IN_PROGRESS) + HandleGameObject(0, true, pGo); + break; + case GO_ZIGGURAT3: + ziggurat3GUID = pGo->GetGUID(); + if (GetData(TYPE_PALLID) == IN_PROGRESS) + HandleGameObject(0, true, pGo); + break; + case GO_ZIGGURAT4: + ziggurat4GUID = pGo->GetGUID(); + if (GetData(TYPE_BARON) == DONE || GetData(TYPE_RAMSTEIN) == DONE) + HandleGameObject(0, true, pGo); + break; + case GO_ZIGGURAT5: + ziggurat5GUID = pGo->GetGUID(); + if (GetData(TYPE_BARON) == DONE || GetData(TYPE_RAMSTEIN) == DONE) + HandleGameObject(0, true, pGo); + break; + case GO_PORT_GAUNTLET: + portGauntletGUID = pGo->GetGUID(); + if (GetData(TYPE_BARONESS) == IN_PROGRESS && GetData(TYPE_NERUB) == IN_PROGRESS && GetData(TYPE_PALLID) == IN_PROGRESS) + HandleGameObject(0, true, pGo); + break; + case GO_PORT_SLAUGTHER: + portSlaugtherGUID = pGo->GetGUID(); + if (GetData(TYPE_BARONESS) == IN_PROGRESS && GetData(TYPE_NERUB) == IN_PROGRESS && GetData(TYPE_PALLID) == IN_PROGRESS) + HandleGameObject(0, true, pGo); + break; + case GO_PORT_ELDERS: + portElderGUID = pGo->GetGUID(); + break; + } } - } - void SetData(uint32 type, uint32 data) - { - switch(type) + void SetData(uint32 type, uint32 data) { - case TYPE_BARON_RUN: - switch(data) + switch(type) { - case IN_PROGRESS: - if (Encounter[0] == IN_PROGRESS || Encounter[0] == FAIL) + case TYPE_BARON_RUN: + switch(data) + { + case IN_PROGRESS: + if (Encounter[0] == IN_PROGRESS || Encounter[0] == FAIL) + break; + Encounter[0] = data; + BaronRun_Timer = 2700000; + sLog.outDebug("TSCR: Instance Stratholme: Baron run in progress."); + break; + case FAIL: + //may add code to remove aura from players, but in theory the time should be up already and removed. + Encounter[0] = data; break; - Encounter[0] = data; - BaronRun_Timer = 2700000; - sLog.outDebug("TSCR: Instance Stratholme: Baron run in progress."); + case DONE: + Encounter[0] = data; + if (Creature* pYsidaT = instance->GetCreature(ysidaTriggerGUID)) + pYsidaT->SummonCreature(C_YSIDA, + pYsidaT->GetPositionX(),pYsidaT->GetPositionY(),pYsidaT->GetPositionZ(),pYsidaT->GetOrientation(), + TEMPSUMMON_TIMED_DESPAWN,1800000); + BaronRun_Timer = 0; + break; + } break; - case FAIL: - //may add code to remove aura from players, but in theory the time should be up already and removed. - Encounter[0] = data; + case TYPE_BARONESS: + Encounter[1] = data; + if (data == IN_PROGRESS) + HandleGameObject(ziggurat1GUID, true); + if (data == IN_PROGRESS) //change to DONE when crystals implemented + StartSlaugtherSquare(); break; - case DONE: - Encounter[0] = data; - if (Creature* pYsidaT = instance->GetCreature(ysidaTriggerGUID)) - pYsidaT->SummonCreature(C_YSIDA, - pYsidaT->GetPositionX(),pYsidaT->GetPositionY(),pYsidaT->GetPositionZ(),pYsidaT->GetOrientation(), - TEMPSUMMON_TIMED_DESPAWN,1800000); - BaronRun_Timer = 0; + case TYPE_NERUB: + Encounter[2] = data; + if (data == IN_PROGRESS) + HandleGameObject(ziggurat2GUID, true); + if (data == IN_PROGRESS) //change to DONE when crystals implemented + StartSlaugtherSquare(); break; - } - break; - case TYPE_BARONESS: - Encounter[1] = data; - if (data == IN_PROGRESS) - HandleGameObject(ziggurat1GUID, true); - if (data == IN_PROGRESS) //change to DONE when crystals implemented - StartSlaugtherSquare(); - break; - case TYPE_NERUB: - Encounter[2] = data; - if (data == IN_PROGRESS) - HandleGameObject(ziggurat2GUID, true); - if (data == IN_PROGRESS) //change to DONE when crystals implemented - StartSlaugtherSquare(); - break; - case TYPE_PALLID: - Encounter[3] = data; - if (data == IN_PROGRESS) - HandleGameObject(ziggurat3GUID, true); - if (data == IN_PROGRESS) //change to DONE when crystals implemented - StartSlaugtherSquare(); - break; - case TYPE_RAMSTEIN: - if (data == IN_PROGRESS) - { - HandleGameObject(portGauntletGUID, false); - - uint32 count = abomnationGUID.size(); - for (std::set<uint64>::const_iterator i = abomnationGUID.begin(); i != abomnationGUID.end(); ++i) + case TYPE_PALLID: + Encounter[3] = data; + if (data == IN_PROGRESS) + HandleGameObject(ziggurat3GUID, true); + if (data == IN_PROGRESS) //change to DONE when crystals implemented + StartSlaugtherSquare(); + break; + case TYPE_RAMSTEIN: + if (data == IN_PROGRESS) { - if (Creature* pAbom = instance->GetCreature(*i)) + HandleGameObject(portGauntletGUID, false); + + uint32 count = abomnationGUID.size(); + for (std::set<uint64>::const_iterator i = abomnationGUID.begin(); i != abomnationGUID.end(); ++i) { - if (!pAbom->isAlive()) - --count; + if (Creature* pAbom = instance->GetCreature(*i)) + { + if (!pAbom->isAlive()) + --count; + } } - } - if (!count) - { - //a bit itchy, it should close the door after 10 secs, but it doesn't. skipping it for now. - //UpdateGoState(ziggurat4GUID,0,true); - if (Creature* pBaron = instance->GetCreature(baronGUID)) - pBaron->SummonCreature(C_RAMSTEIN,4032.84,-3390.24,119.73,4.71,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,1800000); - sLog.outDebug("TSCR: Instance Stratholme: Ramstein spawned."); + if (!count) + { + //a bit itchy, it should close the door after 10 secs, but it doesn't. skipping it for now. + //UpdateGoState(ziggurat4GUID,0,true); + if (Creature* pBaron = instance->GetCreature(baronGUID)) + pBaron->SummonCreature(C_RAMSTEIN,4032.84,-3390.24,119.73,4.71,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,1800000); + sLog.outDebug("TSCR: Instance Stratholme: Ramstein spawned."); + } + else + sLog.outDebug("TSCR: Instance Stratholme: %u Abomnation left to kill.",count); } - else - sLog.outDebug("TSCR: Instance Stratholme: %u Abomnation left to kill.",count); - } - if (data == NOT_STARTED) - HandleGameObject(portGauntletGUID, true); + if (data == NOT_STARTED) + HandleGameObject(portGauntletGUID, true); - if (data == DONE) - { - SlaugtherSquare_Timer = 300000; - sLog.outDebug("TSCR: Instance Stratholme: Slaugther event will continue in 5 minutes."); - } - Encounter[4] = data; - break; - case TYPE_BARON: - if (data == IN_PROGRESS) - { - HandleGameObject(ziggurat4GUID, false); - HandleGameObject(ziggurat5GUID, false); - if (GetData(TYPE_BARON_RUN) == IN_PROGRESS) + if (data == DONE) { - Map::PlayerList const& players = instance->GetPlayers(); - - if (!players.isEmpty()) + SlaugtherSquare_Timer = 300000; + sLog.outDebug("TSCR: Instance Stratholme: Slaugther event will continue in 5 minutes."); + } + Encounter[4] = data; + break; + case TYPE_BARON: + if (data == IN_PROGRESS) + { + HandleGameObject(ziggurat4GUID, false); + HandleGameObject(ziggurat5GUID, false); + if (GetData(TYPE_BARON_RUN) == IN_PROGRESS) { - 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()) + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) { - if (pPlayer->HasAura(SPELL_BARON_ULTIMATUM)) - pPlayer->RemoveAurasDueToSpell(SPELL_BARON_ULTIMATUM); - - if (pPlayer->GetQuestStatus(QUEST_DEAD_MAN_PLEA) == QUEST_STATUS_INCOMPLETE) - pPlayer->AreaExploredOrEventHappens(QUEST_DEAD_MAN_PLEA); + if (Player* pPlayer = itr->getSource()) + { + if (pPlayer->HasAura(SPELL_BARON_ULTIMATUM)) + pPlayer->RemoveAurasDueToSpell(SPELL_BARON_ULTIMATUM); + + if (pPlayer->GetQuestStatus(QUEST_DEAD_MAN_PLEA) == QUEST_STATUS_INCOMPLETE) + pPlayer->AreaExploredOrEventHappens(QUEST_DEAD_MAN_PLEA); + } } } - } - SetData(TYPE_BARON_RUN,DONE); + SetData(TYPE_BARON_RUN,DONE); + } } + if (data == DONE || data == NOT_STARTED) + { + HandleGameObject(ziggurat4GUID, true); + HandleGameObject(ziggurat5GUID, true); + } + if (data == DONE) + HandleGameObject(portGauntletGUID, true); + Encounter[5] = data; + break; + case TYPE_SH_AELMAR: + IsSilverHandDead[0] = (data) ? true : false; + break; + case TYPE_SH_CATHELA: + IsSilverHandDead[1] = (data) ? true : false; + break; + case TYPE_SH_GREGOR: + IsSilverHandDead[2] = (data) ? true : false; + break; + case TYPE_SH_NEMAS: + IsSilverHandDead[3] = (data) ? true : false; + break; + case TYPE_SH_VICAR: + IsSilverHandDead[4] = (data) ? true : false; + break; } - if (data == DONE || data == NOT_STARTED) - { - HandleGameObject(ziggurat4GUID, true); - HandleGameObject(ziggurat5GUID, true); - } - if (data == DONE) - HandleGameObject(portGauntletGUID, true); - Encounter[5] = data; - break; - case TYPE_SH_AELMAR: - IsSilverHandDead[0] = (data) ? true : false; - break; - case TYPE_SH_CATHELA: - IsSilverHandDead[1] = (data) ? true : false; - break; - case TYPE_SH_GREGOR: - IsSilverHandDead[2] = (data) ? true : false; - break; - case TYPE_SH_NEMAS: - IsSilverHandDead[3] = (data) ? true : false; - break; - case TYPE_SH_VICAR: - IsSilverHandDead[4] = (data) ? true : false; - break; + if (data == DONE)SaveToDB(); } - if (data == DONE)SaveToDB(); - } - std::string GetSaveData() - { - OUT_SAVE_INST_DATA; + std::string GetSaveData() + { + OUT_SAVE_INST_DATA; - std::ostringstream saveStream; - saveStream << Encounter[0] << " " << Encounter[1] << " " << Encounter[2] << " " - << Encounter[3] << " " << Encounter[4] << " " << Encounter[5]; + std::ostringstream saveStream; + saveStream << Encounter[0] << " " << Encounter[1] << " " << Encounter[2] << " " + << Encounter[3] << " " << Encounter[4] << " " << Encounter[5]; - OUT_SAVE_INST_DATA_COMPLETE; - return saveStream.str(); - } - - void Load(const char* in) - { - if (!in) - { - OUT_LOAD_INST_DATA_FAIL; - return; + 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; + } - std::istringstream loadStream(in); - loadStream >> Encounter[0] >> Encounter[1] >> Encounter[2] >> Encounter[3] - >> Encounter[4] >> Encounter[5]; + OUT_LOAD_INST_DATA(in); - // Do not reset 1, 2 and 3. they are not set to done, yet . - if (Encounter[0] == IN_PROGRESS) - Encounter[0] = NOT_STARTED; - if (Encounter[4] == IN_PROGRESS) - Encounter[4] = NOT_STARTED; - if (Encounter[5] == IN_PROGRESS) - Encounter[5] = NOT_STARTED; + std::istringstream loadStream(in); + loadStream >> Encounter[0] >> Encounter[1] >> Encounter[2] >> Encounter[3] + >> Encounter[4] >> Encounter[5]; - OUT_LOAD_INST_DATA_COMPLETE; - } + // Do not reset 1, 2 and 3. they are not set to done, yet . + if (Encounter[0] == IN_PROGRESS) + Encounter[0] = NOT_STARTED; + if (Encounter[4] == IN_PROGRESS) + Encounter[4] = NOT_STARTED; + if (Encounter[5] == IN_PROGRESS) + Encounter[5] = NOT_STARTED; - uint32 GetData(uint32 type) - { - switch(type) - { - case TYPE_SH_QUEST: - if (IsSilverHandDead[0] && IsSilverHandDead[1] && IsSilverHandDead[2] && IsSilverHandDead[3] && IsSilverHandDead[4]) - return 1; - return 0; - case TYPE_BARON_RUN: - return Encounter[0]; - case TYPE_BARONESS: - return Encounter[1]; - case TYPE_NERUB: - return Encounter[2]; - case TYPE_PALLID: - return Encounter[3]; - case TYPE_RAMSTEIN: - return Encounter[4]; - case TYPE_BARON: - return Encounter[5]; - } - return 0; - } + OUT_LOAD_INST_DATA_COMPLETE; + } - uint64 GetData64(uint32 data) - { - switch(data) + uint32 GetData(uint32 type) { - case DATA_BARON: - return baronGUID; - case DATA_YSIDA_TRIGGER: - return ysidaTriggerGUID; + switch(type) + { + case TYPE_SH_QUEST: + if (IsSilverHandDead[0] && IsSilverHandDead[1] && IsSilverHandDead[2] && IsSilverHandDead[3] && IsSilverHandDead[4]) + return 1; + return 0; + case TYPE_BARON_RUN: + return Encounter[0]; + case TYPE_BARONESS: + return Encounter[1]; + case TYPE_NERUB: + return Encounter[2]; + case TYPE_PALLID: + return Encounter[3]; + case TYPE_RAMSTEIN: + return Encounter[4]; + case TYPE_BARON: + return Encounter[5]; + } + return 0; } - return 0; - } - void Update(uint32 diff) - { - if (BaronRun_Timer) + uint64 GetData64(uint32 data) { - if (BaronRun_Timer <= diff) + switch(data) { - if (GetData(TYPE_BARON_RUN) != DONE) - SetData(TYPE_BARON_RUN, FAIL); - BaronRun_Timer = 0; - sLog.outDebug("TSCR: Instance Stratholme: Baron run event reached end. Event has state %u.",GetData(TYPE_BARON_RUN)); - } else BaronRun_Timer -= diff; + case DATA_BARON: + return baronGUID; + case DATA_YSIDA_TRIGGER: + return ysidaTriggerGUID; + } + return 0; } - if (SlaugtherSquare_Timer) + void Update(uint32 diff) { - if (SlaugtherSquare_Timer <= diff) + if (BaronRun_Timer) + { + if (BaronRun_Timer <= diff) + { + if (GetData(TYPE_BARON_RUN) != DONE) + SetData(TYPE_BARON_RUN, FAIL); + BaronRun_Timer = 0; + sLog.outDebug("TSCR: Instance Stratholme: Baron run event reached end. Event has state %u.",GetData(TYPE_BARON_RUN)); + } else BaronRun_Timer -= diff; + } + + if (SlaugtherSquare_Timer) { - if (Creature* pBaron = instance->GetCreature(baronGUID)) + if (SlaugtherSquare_Timer <= diff) { - for (uint8 i = 0; i < 4; ++i) - pBaron->SummonCreature(C_BLACK_GUARD,4032.84,-3390.24,119.73,4.71,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,1800000); + if (Creature* pBaron = instance->GetCreature(baronGUID)) + { + for (uint8 i = 0; i < 4; ++i) + pBaron->SummonCreature(C_BLACK_GUARD,4032.84,-3390.24,119.73,4.71,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,1800000); - HandleGameObject(ziggurat4GUID, true); - HandleGameObject(ziggurat5GUID, true); - sLog.outDebug("TSCR: Instance Stratholme: Black guard sentries spawned. Opening gates to baron."); - } - SlaugtherSquare_Timer = 0; - } else SlaugtherSquare_Timer -= diff; + HandleGameObject(ziggurat4GUID, true); + HandleGameObject(ziggurat5GUID, true); + sLog.outDebug("TSCR: Instance Stratholme: Black guard sentries spawned. Opening gates to baron."); + } + SlaugtherSquare_Timer = 0; + } else SlaugtherSquare_Timer -= diff; + } } - } + }; + }; -InstanceData* GetInstanceData_instance_stratholme(Map* pMap) -{ - return new instance_stratholme(pMap); -} void AddSC_instance_stratholme() { - Script *newscript; - newscript = new Script; - newscript->Name = "instance_stratholme"; - newscript->GetInstanceData = &GetInstanceData_instance_stratholme; - newscript->RegisterSelf(); + new instance_stratholme(); } - diff --git a/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp b/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp index ed87b7fdccb..dfb691fa65d 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp @@ -36,38 +36,44 @@ EndContentData */ /*###### ## go_gauntlet_gate (this is the _first_ of the gauntlet gates, two exist) ######*/ - -bool GOHello_go_gauntlet_gate(Player* pPlayer, GameObject* pGo) +
class go_gauntlet_gate : public GameObjectScript { - ScriptedInstance* pInstance = pGo->GetInstanceData(); +public: + go_gauntlet_gate() : GameObjectScript("go_gauntlet_gate") { } - if (!pInstance) - return false; + bool OnGossipHello(Player* pPlayer, GameObject* pGo) + { + InstanceScript* pInstance = pGo->GetInstanceScript(); - if (pInstance->GetData(TYPE_BARON_RUN) != NOT_STARTED) - return false; + if (!pInstance) + return false; - if (Group *pGroup = pPlayer->GetGroup()) - { - for (GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) + if (pInstance->GetData(TYPE_BARON_RUN) != NOT_STARTED) + return false; + + if (Group *pGroup = pPlayer->GetGroup()) { - Player* pGroupie = itr->getSource(); - if (!pGroupie) - continue; - - if (pGroupie->GetQuestStatus(QUEST_DEAD_MAN_PLEA) == QUEST_STATUS_INCOMPLETE && - !pGroupie->HasAura(SPELL_BARON_ULTIMATUM) && - pGroupie->GetMap() == pGo->GetMap()) - pGroupie->CastSpell(pGroupie,SPELL_BARON_ULTIMATUM,true); - } - } else if (pPlayer->GetQuestStatus(QUEST_DEAD_MAN_PLEA) == QUEST_STATUS_INCOMPLETE && - !pPlayer->HasAura(SPELL_BARON_ULTIMATUM) && - pPlayer->GetMap() == pGo->GetMap()) - pPlayer->CastSpell(pPlayer,SPELL_BARON_ULTIMATUM,true); + for (GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) + { + Player* pGroupie = itr->getSource(); + if (!pGroupie) + continue; + + if (pGroupie->GetQuestStatus(QUEST_DEAD_MAN_PLEA) == QUEST_STATUS_INCOMPLETE && + !pGroupie->HasAura(SPELL_BARON_ULTIMATUM) && + pGroupie->GetMap() == pGo->GetMap()) + pGroupie->CastSpell(pGroupie,SPELL_BARON_ULTIMATUM,true); + } + } else if (pPlayer->GetQuestStatus(QUEST_DEAD_MAN_PLEA) == QUEST_STATUS_INCOMPLETE && + !pPlayer->HasAura(SPELL_BARON_ULTIMATUM) && + pPlayer->GetMap() == pGo->GetMap()) + pPlayer->CastSpell(pPlayer,SPELL_BARON_ULTIMATUM,true); - pInstance->SetData(TYPE_BARON_RUN,IN_PROGRESS); - return false; -} + pInstance->SetData(TYPE_BARON_RUN,IN_PROGRESS); + return false; + } + +}; /*###### ## mob_freed_soul @@ -78,23 +84,30 @@ bool GOHello_go_gauntlet_gate(Player* pPlayer, GameObject* pGo) #define SAY_ZAPPED1 -1329001 #define SAY_ZAPPED2 -1329002 #define SAY_ZAPPED3 -1329003 - -struct mob_freed_soulAI : public ScriptedAI +
class mob_freed_soul : public CreatureScript { - mob_freed_soulAI(Creature *c) : ScriptedAI(c) {} +public: + mob_freed_soul() : CreatureScript("mob_freed_soul") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - DoScriptText(RAND(SAY_ZAPPED0,SAY_ZAPPED1,SAY_ZAPPED2,SAY_ZAPPED3), me); + return new mob_freed_soulAI (pCreature); } - void EnterCombat(Unit* /*who*/) {} + struct mob_freed_soulAI : public ScriptedAI + { + mob_freed_soulAI(Creature *c) : ScriptedAI(c) {} + + void Reset() + { + DoScriptText(RAND(SAY_ZAPPED0,SAY_ZAPPED1,SAY_ZAPPED2,SAY_ZAPPED3), me); + } + + void EnterCombat(Unit* /*who*/) {} + }; + }; -CreatureAI* GetAI_mob_freed_soul(Creature* pCreature) -{ - return new mob_freed_soulAI (pCreature); -} /*###### ## mob_restless_soul @@ -105,67 +118,74 @@ CreatureAI* GetAI_mob_freed_soul(Creature* pCreature) #define QUEST_RESTLESS_SOUL 5282 #define ENTRY_RESTLESS 11122 #define ENTRY_FREED 11136 - -struct mob_restless_soulAI : public ScriptedAI +
class mob_restless_soul : public CreatureScript { - mob_restless_soulAI(Creature *c) : ScriptedAI(c) {} +public: + mob_restless_soul() : CreatureScript("mob_restless_soul") { } - uint64 Tagger; - uint32 Die_Timer; - bool Tagged; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - Tagger = 0; - Die_Timer = 5000; - Tagged = false; + return new mob_restless_soulAI (pCreature); } - void EnterCombat(Unit* /*who*/) {} - - void SpellHit(Unit *caster, const SpellEntry *spell) + struct mob_restless_soulAI : public ScriptedAI { - if (caster->GetTypeId() == TYPEID_PLAYER) + mob_restless_soulAI(Creature *c) : ScriptedAI(c) {} + + uint64 Tagger; + uint32 Die_Timer; + bool Tagged; + + void Reset() + { + Tagger = 0; + Die_Timer = 5000; + Tagged = false; + } + + void EnterCombat(Unit* /*who*/) {} + + void SpellHit(Unit *caster, const SpellEntry *spell) { - if (!Tagged && spell->Id == SPELL_EGAN_BLASTER && CAST_PLR(caster)->GetQuestStatus(QUEST_RESTLESS_SOUL) == QUEST_STATUS_INCOMPLETE) + if (caster->GetTypeId() == TYPEID_PLAYER) { - Tagged = true; - Tagger = caster->GetGUID(); + if (!Tagged && spell->Id == SPELL_EGAN_BLASTER && CAST_PLR(caster)->GetQuestStatus(QUEST_RESTLESS_SOUL) == QUEST_STATUS_INCOMPLETE) + { + Tagged = true; + Tagger = caster->GetGUID(); + } } } - } - void JustSummoned(Creature *summoned) - { - summoned->CastSpell(summoned,SPELL_SOUL_FREED,false); - } + void JustSummoned(Creature *summoned) + { + summoned->CastSpell(summoned,SPELL_SOUL_FREED,false); + } - void JustDied(Unit* /*Killer*/) - { - if (Tagged) - me->SummonCreature(ENTRY_FREED, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation(), TEMPSUMMON_TIMED_DESPAWN, 300000); - } + void JustDied(Unit* /*Killer*/) + { + if (Tagged) + me->SummonCreature(ENTRY_FREED, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation(), TEMPSUMMON_TIMED_DESPAWN, 300000); + } - void UpdateAI(const uint32 diff) - { - if (Tagged) + void UpdateAI(const uint32 diff) { - if (Die_Timer <= diff) + if (Tagged) { - if (Unit* pTemp = Unit::GetUnit(*me,Tagger)) + if (Die_Timer <= diff) { - CAST_PLR(pTemp)->KilledMonsterCredit(ENTRY_RESTLESS, me->GetGUID()); - me->Kill(me); - } - } else Die_Timer -= diff; + if (Unit* pTemp = Unit::GetUnit(*me,Tagger)) + { + CAST_PLR(pTemp)->KilledMonsterCredit(ENTRY_RESTLESS, me->GetGUID()); + me->Kill(me); + } + } else Die_Timer -= diff; + } } - } + }; + }; -CreatureAI* GetAI_mob_restless_soul(Creature* pCreature) -{ - return new mob_restless_soulAI (pCreature); -} /*###### ## mobs_spectral_ghostly_citizen @@ -176,109 +196,98 @@ enum eGhostlyCitizenSpells SPELL_HAUNTING_PHANTOM = 16336, SPELL_SLAP = 6754 }; - -struct mobs_spectral_ghostly_citizenAI : public ScriptedAI +
class mobs_spectral_ghostly_citizen : public CreatureScript { - mobs_spectral_ghostly_citizenAI(Creature *c) : ScriptedAI(c) {} +public: + mobs_spectral_ghostly_citizen() : CreatureScript("mobs_spectral_ghostly_citizen") { } - uint32 Die_Timer; - bool Tagged; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - Die_Timer = 5000; - Tagged = false; + return new mobs_spectral_ghostly_citizenAI (pCreature); } - void EnterCombat(Unit* /*who*/) {} - - void SpellHit(Unit * /*caster*/, const SpellEntry *spell) + struct mobs_spectral_ghostly_citizenAI : public ScriptedAI { - if (!Tagged && spell->Id == SPELL_EGAN_BLASTER) - Tagged = true; - } + mobs_spectral_ghostly_citizenAI(Creature *c) : ScriptedAI(c) {} - void JustDied(Unit* /*Killer*/) - { - if (Tagged) + uint32 Die_Timer; + bool Tagged; + + void Reset() + { + Die_Timer = 5000; + Tagged = false; + } + + void EnterCombat(Unit* /*who*/) {} + + void SpellHit(Unit * /*caster*/, const SpellEntry *spell) + { + if (!Tagged && spell->Id == SPELL_EGAN_BLASTER) + Tagged = true; + } + + void JustDied(Unit* /*Killer*/) { - for (uint32 i = 1; i <= 4; ++i) + if (Tagged) { - //100%, 50%, 33%, 25% chance to spawn - if (urand(1,i) == 1) - DoSummon(ENTRY_RESTLESS, me, 20.0f, 600000); + for (uint32 i = 1; i <= 4; ++i) + { + //100%, 50%, 33%, 25% chance to spawn + if (urand(1,i) == 1) + DoSummon(ENTRY_RESTLESS, me, 20.0f, 600000); + } } } - } - void UpdateAI(const uint32 diff) - { - if (Tagged) + void UpdateAI(const uint32 diff) { - if (Die_Timer <= diff) - me->Kill(me); - else Die_Timer -= diff; - } + if (Tagged) + { + if (Die_Timer <= diff) + me->Kill(me); + else Die_Timer -= diff; + } - if (!UpdateVictim()) - return; + if (!UpdateVictim()) + return; - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - void ReceiveEmote(Player* pPlayer, uint32 emote) - { - switch(emote) + void ReceiveEmote(Player* pPlayer, uint32 emote) { - case TEXTEMOTE_DANCE: - EnterEvadeMode(); - break; - case TEXTEMOTE_RUDE: - if (me->IsWithinDistInMap(pPlayer, 5)) - DoCast(pPlayer, SPELL_SLAP, false); - else - me->HandleEmoteCommand(EMOTE_ONESHOT_RUDE); - break; - case TEXTEMOTE_WAVE: - me->HandleEmoteCommand(EMOTE_ONESHOT_WAVE); - break; - case TEXTEMOTE_BOW: - me->HandleEmoteCommand(EMOTE_ONESHOT_BOW); - break; - case TEXTEMOTE_KISS: - me->HandleEmoteCommand(EMOTE_ONESHOT_FLEX); - break; + switch(emote) + { + case TEXTEMOTE_DANCE: + EnterEvadeMode(); + break; + case TEXTEMOTE_RUDE: + if (me->IsWithinDistInMap(pPlayer, 5)) + DoCast(pPlayer, SPELL_SLAP, false); + else + me->HandleEmoteCommand(EMOTE_ONESHOT_RUDE); + break; + case TEXTEMOTE_WAVE: + me->HandleEmoteCommand(EMOTE_ONESHOT_WAVE); + break; + case TEXTEMOTE_BOW: + me->HandleEmoteCommand(EMOTE_ONESHOT_BOW); + break; + case TEXTEMOTE_KISS: + me->HandleEmoteCommand(EMOTE_ONESHOT_FLEX); + break; + } } - } + }; + }; -CreatureAI* GetAI_mobs_spectral_ghostly_citizen(Creature* pCreature) -{ - return new mobs_spectral_ghostly_citizenAI (pCreature); -} void AddSC_stratholme() { - Script *newscript; - - newscript = new Script; - newscript->Name = "go_gauntlet_gate"; - newscript->pGOHello = &GOHello_go_gauntlet_gate; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_freed_soul"; - newscript->GetAI = &GetAI_mob_freed_soul; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_restless_soul"; - newscript->GetAI = &GetAI_mob_restless_soul; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mobs_spectral_ghostly_citizen"; - newscript->GetAI = &GetAI_mobs_spectral_ghostly_citizen; - newscript->RegisterSelf(); + new go_gauntlet_gate(); + new mob_freed_soul(); + new mob_restless_soul(); + new mobs_spectral_ghostly_citizen(); } - diff --git a/src/server/scripts/EasternKingdoms/SunkenTemple/instance_sunken_temple.cpp b/src/server/scripts/EasternKingdoms/SunkenTemple/instance_sunken_temple.cpp index 99c018161dc..554d5f45dc7 100644 --- a/src/server/scripts/EasternKingdoms/SunkenTemple/instance_sunken_temple.cpp +++ b/src/server/scripts/EasternKingdoms/SunkenTemple/instance_sunken_temple.cpp @@ -38,169 +38,172 @@ EndScriptData */ #define GO_ATALAI_LIGHT2 148937 #define NPC_MALFURION_STORMRAGE 15362 - -struct instance_sunken_temple : public ScriptedInstance +
class instance_sunken_temple : public InstanceMapScript { - instance_sunken_temple(Map* pMap) : ScriptedInstance(pMap) - { - Initialize(); - }; - - uint64 GOAtalaiStatue1; - uint64 GOAtalaiStatue2; - uint64 GOAtalaiStatue3; - uint64 GOAtalaiStatue4; - uint64 GOAtalaiStatue5; - uint64 GOAtalaiStatue6; - uint64 GOAtalaiIdol; - - uint32 State; +public: + instance_sunken_temple() : InstanceMapScript("instance_sunken_temple") { } - bool s1; - bool s2; - bool s3; - bool s4; - bool s5; - bool s6; - - void Initialize() + InstanceScript* GetInstanceData_InstanceMapScript(Map* pMap) { - GOAtalaiStatue1 = 0; - GOAtalaiStatue2 = 0; - GOAtalaiStatue3 = 0; - GOAtalaiStatue4 = 0; - GOAtalaiStatue5 = 0; - GOAtalaiStatue6 = 0; - GOAtalaiIdol = 0; - - State = 0; - - s1 = false; - s2 = false; - s3 = false; - s4 = false; - s5 = false; - s6 = false; + return new instance_sunken_temple_InstanceMapScript(pMap); } - void OnGameObjectCreate(GameObject* pGo, bool /*add*/) + struct instance_sunken_temple_InstanceMapScript : public InstanceScript { - switch(pGo->GetEntry()) + instance_sunken_temple_InstanceMapScript(Map* pMap) : InstanceScript(pMap) + { + Initialize(); + }; + + uint64 GOAtalaiStatue1; + uint64 GOAtalaiStatue2; + uint64 GOAtalaiStatue3; + uint64 GOAtalaiStatue4; + uint64 GOAtalaiStatue5; + uint64 GOAtalaiStatue6; + uint64 GOAtalaiIdol; + + uint32 State; + + bool s1; + bool s2; + bool s3; + bool s4; + bool s5; + bool s6; + + void Initialize() { - case GO_ATALAI_STATUE1: GOAtalaiStatue1 = pGo->GetGUID(); break; - case GO_ATALAI_STATUE2: GOAtalaiStatue2 = pGo->GetGUID(); break; - case GO_ATALAI_STATUE3: GOAtalaiStatue3 = pGo->GetGUID(); break; - case GO_ATALAI_STATUE4: GOAtalaiStatue4 = pGo->GetGUID(); break; - case GO_ATALAI_STATUE5: GOAtalaiStatue5 = pGo->GetGUID(); break; - case GO_ATALAI_STATUE6: GOAtalaiStatue6 = pGo->GetGUID(); break; - case GO_ATALAI_IDOL: GOAtalaiIdol = pGo->GetGUID(); break; + GOAtalaiStatue1 = 0; + GOAtalaiStatue2 = 0; + GOAtalaiStatue3 = 0; + GOAtalaiStatue4 = 0; + GOAtalaiStatue5 = 0; + GOAtalaiStatue6 = 0; + GOAtalaiIdol = 0; + + State = 0; + + s1 = false; + s2 = false; + s3 = false; + s4 = false; + s5 = false; + s6 = false; } - } - virtual void Update(uint32 /*diff*/) // correct order goes form 1-6 - { - switch(State) - { - case GO_ATALAI_STATUE1: - if (!s1 && !s2 && !s3 && !s4 && !s5 && !s6) - { - if (GameObject *pAtalaiStatue1 = instance->GetGameObject(GOAtalaiStatue1)) - UseStatue(pAtalaiStatue1); - s1 = true; - State = 0; - }; - break; - case GO_ATALAI_STATUE2: - if (s1 && !s2 && !s3 && !s4 && !s5 && !s6) - { - if (GameObject *pAtalaiStatue2 = instance->GetGameObject(GOAtalaiStatue2)) - UseStatue(pAtalaiStatue2); - s2 = true; - State = 0; - }; - break; - case GO_ATALAI_STATUE3: - if (s1 && s2 && !s3 && !s4 && !s5 && !s6) - { - if (GameObject *pAtalaiStatue3 = instance->GetGameObject(GOAtalaiStatue3)) - UseStatue(pAtalaiStatue3); - s3 = true; - State = 0; - }; - break; - case GO_ATALAI_STATUE4: - if (s1 && s2 && s3 && !s4 && !s5 && !s6) - { - if (GameObject *pAtalaiStatue4 = instance->GetGameObject(GOAtalaiStatue4)) - UseStatue(pAtalaiStatue4); - s4 = true; - State = 0; - } - break; - case GO_ATALAI_STATUE5: - if (s1 && s2 && s3 && s4 && !s5 && !s6) - { - if (GameObject *pAtalaiStatue5 = instance->GetGameObject(GOAtalaiStatue5)) - UseStatue(pAtalaiStatue5); - s5 = true; - State = 0; - } - break; - case GO_ATALAI_STATUE6: - if (s1 && s2 && s3 && s4 && s5 && !s6) + void OnGameObjectCreate(GameObject* pGo, bool /*add*/) + { + switch(pGo->GetEntry()) { - if (GameObject *pAtalaiStatue6 = instance->GetGameObject(GOAtalaiStatue6)) - UseStatue(pAtalaiStatue6); - s6 = true; - State = 0; + case GO_ATALAI_STATUE1: GOAtalaiStatue1 = pGo->GetGUID(); break; + case GO_ATALAI_STATUE2: GOAtalaiStatue2 = pGo->GetGUID(); break; + case GO_ATALAI_STATUE3: GOAtalaiStatue3 = pGo->GetGUID(); break; + case GO_ATALAI_STATUE4: GOAtalaiStatue4 = pGo->GetGUID(); break; + case GO_ATALAI_STATUE5: GOAtalaiStatue5 = pGo->GetGUID(); break; + case GO_ATALAI_STATUE6: GOAtalaiStatue6 = pGo->GetGUID(); break; + case GO_ATALAI_IDOL: GOAtalaiIdol = pGo->GetGUID(); break; } - break; + } + + virtual void Update(uint32 /*diff*/) // correct order goes form 1-6 + { + switch(State) + { + case GO_ATALAI_STATUE1: + if (!s1 && !s2 && !s3 && !s4 && !s5 && !s6) + { + if (GameObject *pAtalaiStatue1 = instance->GetGameObject(GOAtalaiStatue1)) + UseStatue(pAtalaiStatue1); + s1 = true; + State = 0; + }; + break; + case GO_ATALAI_STATUE2: + if (s1 && !s2 && !s3 && !s4 && !s5 && !s6) + { + if (GameObject *pAtalaiStatue2 = instance->GetGameObject(GOAtalaiStatue2)) + UseStatue(pAtalaiStatue2); + s2 = true; + State = 0; + }; + break; + case GO_ATALAI_STATUE3: + if (s1 && s2 && !s3 && !s4 && !s5 && !s6) + { + if (GameObject *pAtalaiStatue3 = instance->GetGameObject(GOAtalaiStatue3)) + UseStatue(pAtalaiStatue3); + s3 = true; + State = 0; + }; + break; + case GO_ATALAI_STATUE4: + if (s1 && s2 && s3 && !s4 && !s5 && !s6) + { + if (GameObject *pAtalaiStatue4 = instance->GetGameObject(GOAtalaiStatue4)) + UseStatue(pAtalaiStatue4); + s4 = true; + State = 0; + } + break; + case GO_ATALAI_STATUE5: + if (s1 && s2 && s3 && s4 && !s5 && !s6) + { + if (GameObject *pAtalaiStatue5 = instance->GetGameObject(GOAtalaiStatue5)) + UseStatue(pAtalaiStatue5); + s5 = true; + State = 0; + } + break; + case GO_ATALAI_STATUE6: + if (s1 && s2 && s3 && s4 && s5 && !s6) + { + if (GameObject *pAtalaiStatue6 = instance->GetGameObject(GOAtalaiStatue6)) + UseStatue(pAtalaiStatue6); + s6 = true; + State = 0; + } + break; + } + }; + + void UseStatue(GameObject* pGo) + { + pGo->SummonGameObject(GO_ATALAI_LIGHT1,pGo->GetPositionX(),pGo->GetPositionY(),pGo->GetPositionZ(),0,0,0,0,0,0); + pGo->SetUInt32Value(GAMEOBJECT_FLAGS, 4); + } + + /* + void UseLastStatue(GameObject* pGo) + { + AtalaiStatue1->SummonGameObject(GO_ATALAI_LIGHT2,AtalaiStatue1->GetPositionX(),AtalaiStatue1->GetPositionY(),AtalaiStatue1->GetPositionZ(),0,0,0,0,0,100000); + AtalaiStatue2->SummonGameObject(GO_ATALAI_LIGHT2,AtalaiStatue2->GetPositionX(),AtalaiStatue2->GetPositionY(),AtalaiStatue2->GetPositionZ(),0,0,0,0,0,100000); + AtalaiStatue3->SummonGameObject(GO_ATALAI_LIGHT2,AtalaiStatue3->GetPositionX(),AtalaiStatue3->GetPositionY(),AtalaiStatue3->GetPositionZ(),0,0,0,0,0,100000); + AtalaiStatue4->SummonGameObject(GO_ATALAI_LIGHT2,AtalaiStatue4->GetPositionX(),AtalaiStatue4->GetPositionY(),AtalaiStatue4->GetPositionZ(),0,0,0,0,0,100000); + AtalaiStatue5->SummonGameObject(GO_ATALAI_LIGHT2,AtalaiStatue5->GetPositionX(),AtalaiStatue5->GetPositionY(),AtalaiStatue5->GetPositionZ(),0,0,0,0,0,100000); + AtalaiStatue6->SummonGameObject(GO_ATALAI_LIGHT2,AtalaiStatue6->GetPositionX(),AtalaiStatue6->GetPositionY(),AtalaiStatue6->GetPositionZ(),0,0,0,0,0,100000); + pGo->SummonGameObject(148838,-488.997,96.61,-189.019,-1.52,0,0,0,0,100000); } - }; + */ - void UseStatue(GameObject* pGo) - { - pGo->SummonGameObject(GO_ATALAI_LIGHT1,pGo->GetPositionX(),pGo->GetPositionY(),pGo->GetPositionZ(),0,0,0,0,0,0); - pGo->SetUInt32Value(GAMEOBJECT_FLAGS, 4); - } + void SetData(uint32 type, uint32 data) + { + if (type == EVENT_STATE) + State = data; + } + + uint32 GetData(uint32 type) + { + if (type == EVENT_STATE) + return State; + return 0; + } + }; - /* - void UseLastStatue(GameObject* pGo) - { - AtalaiStatue1->SummonGameObject(GO_ATALAI_LIGHT2,AtalaiStatue1->GetPositionX(),AtalaiStatue1->GetPositionY(),AtalaiStatue1->GetPositionZ(),0,0,0,0,0,100000); - AtalaiStatue2->SummonGameObject(GO_ATALAI_LIGHT2,AtalaiStatue2->GetPositionX(),AtalaiStatue2->GetPositionY(),AtalaiStatue2->GetPositionZ(),0,0,0,0,0,100000); - AtalaiStatue3->SummonGameObject(GO_ATALAI_LIGHT2,AtalaiStatue3->GetPositionX(),AtalaiStatue3->GetPositionY(),AtalaiStatue3->GetPositionZ(),0,0,0,0,0,100000); - AtalaiStatue4->SummonGameObject(GO_ATALAI_LIGHT2,AtalaiStatue4->GetPositionX(),AtalaiStatue4->GetPositionY(),AtalaiStatue4->GetPositionZ(),0,0,0,0,0,100000); - AtalaiStatue5->SummonGameObject(GO_ATALAI_LIGHT2,AtalaiStatue5->GetPositionX(),AtalaiStatue5->GetPositionY(),AtalaiStatue5->GetPositionZ(),0,0,0,0,0,100000); - AtalaiStatue6->SummonGameObject(GO_ATALAI_LIGHT2,AtalaiStatue6->GetPositionX(),AtalaiStatue6->GetPositionY(),AtalaiStatue6->GetPositionZ(),0,0,0,0,0,100000); - pGo->SummonGameObject(148838,-488.997,96.61,-189.019,-1.52,0,0,0,0,100000); - } - */ - - void SetData(uint32 type, uint32 data) - { - if (type == EVENT_STATE) - State = data; - } - - uint32 GetData(uint32 type) - { - if (type == EVENT_STATE) - return State; - return 0; - } }; -InstanceData* GetInstanceData_instance_sunken_temple(Map* pMap) -{ - return new instance_sunken_temple(pMap); -} void AddSC_instance_sunken_temple() { - Script *newscript; - newscript = new Script; - newscript->Name = "instance_sunken_temple"; - newscript->GetInstanceData = &GetInstanceData_instance_sunken_temple; - newscript->RegisterSelf(); + new instance_sunken_temple(); } diff --git a/src/server/scripts/EasternKingdoms/SunkenTemple/sunken_temple.cpp b/src/server/scripts/EasternKingdoms/SunkenTemple/sunken_temple.cpp index ca49cac4908..98bb24cbf6c 100644 --- a/src/server/scripts/EasternKingdoms/SunkenTemple/sunken_temple.cpp +++ b/src/server/scripts/EasternKingdoms/SunkenTemple/sunken_temple.cpp @@ -33,41 +33,44 @@ EndContentData */ /*##### # at_malfurion_Stormrage_trigger #####*/ - -bool AreaTrigger_at_malfurion_stormrage(Player* pPlayer, const AreaTriggerEntry * /*at*/) +
class at_malfurion_stormrage : public AreaTriggerScript { - if (ScriptedInstance* pInstance = pPlayer->GetInstanceData()) +public: + at_malfurion_stormrage() : AreaTriggerScript("at_malfurion_stormrage") { } + + bool OnTrigger(Player* pPlayer, const AreaTriggerEntry * /*at*/) { - if (!pPlayer->FindNearestCreature(15362,15)) - pPlayer->SummonCreature(15362, pPlayer->GetPositionX(), pPlayer->GetPositionY(), pPlayer->GetPositionZ(), -1.52, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 100000); - return false; + if (InstanceScript* pInstance = pPlayer->GetInstanceScript()) + { + if (!pPlayer->FindNearestCreature(15362,15)) + pPlayer->SummonCreature(15362, pPlayer->GetPositionX(), pPlayer->GetPositionY(), pPlayer->GetPositionZ(), -1.52, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 100000); + return false; + } + return false; } -return false; -} + +}; /*##### # go_atalai_statue #####*/ - -bool GOHello_go_atalai_statue(Player* pPlayer, GameObject* pGo) +
class go_atalai_statue : public GameObjectScript { - ScriptedInstance* pInstance = pPlayer->GetInstanceData(); - if (!pInstance) +public: + go_atalai_statue() : GameObjectScript("go_atalai_statue") { } + + bool OnGossipHello(Player* pPlayer, GameObject* pGo) + { + InstanceScript* pInstance = pPlayer->GetInstanceScript(); + if (!pInstance) + return false; + pInstance->SetData(EVENT_STATE,pGo->GetEntry()); return false; - pInstance->SetData(EVENT_STATE,pGo->GetEntry()); - return false; -} + } + +}; void AddSC_sunken_temple() { - Script *newscript; - - newscript = new Script; - newscript->Name = "at_malfurion_stormrage"; - newscript->pAreaTrigger = &AreaTrigger_at_malfurion_stormrage; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "go_atalai_statue"; - newscript->pGOHello = &GOHello_go_atalai_statue; - newscript->RegisterSelf(); + new at_malfurion_stormrage(); + new go_atalai_statue(); } diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp index 5aa1daaad77..ad773f070a7 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp @@ -65,287 +65,289 @@ enum Spells }; #define FELMYST 25038 - -struct boss_brutallusAI : public ScriptedAI +
class boss_brutallus : public CreatureScript { - boss_brutallusAI(Creature *c) : ScriptedAI(c) +public: + boss_brutallus() : CreatureScript("boss_brutallus") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); - Intro = true; + return new boss_brutallusAI (pCreature); } - ScriptedInstance* pInstance; + struct boss_brutallusAI : public ScriptedAI + { + boss_brutallusAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + Intro = true; + } - uint32 SlashTimer; - uint32 BurnTimer; - uint32 StompTimer; - uint32 BerserkTimer; + InstanceScript* pInstance; - uint32 IntroPhase; - uint32 IntroPhaseTimer; - uint32 IntroFrostBoltTimer; + uint32 SlashTimer; + uint32 BurnTimer; + uint32 StompTimer; + uint32 BerserkTimer; - bool Intro; - bool IsIntro; - bool Enraged; + uint32 IntroPhase; + uint32 IntroPhaseTimer; + uint32 IntroFrostBoltTimer; - void Reset() - { - SlashTimer = 11000; - StompTimer = 30000; - BurnTimer = 60000; - BerserkTimer = 360000; + bool Intro; + bool IsIntro; + bool Enraged; - IntroPhase = 0; - IntroPhaseTimer = 0; - IntroFrostBoltTimer = 0; + void Reset() + { + SlashTimer = 11000; + StompTimer = 30000; + BurnTimer = 60000; + BerserkTimer = 360000; - IsIntro = false; - Enraged = false; + IntroPhase = 0; + IntroPhaseTimer = 0; + IntroFrostBoltTimer = 0; - DoCast(me, SPELL_DUAL_WIELD, true); + IsIntro = false; + Enraged = false; - if (pInstance) - pInstance->SetData(DATA_BRUTALLUS_EVENT, NOT_STARTED); - } + DoCast(me, SPELL_DUAL_WIELD, true); - void EnterCombat(Unit * /*who*/) - { - DoScriptText(YELL_AGGRO, me); + if (pInstance) + pInstance->SetData(DATA_BRUTALLUS_EVENT, NOT_STARTED); + } - if (pInstance) - pInstance->SetData(DATA_BRUTALLUS_EVENT, IN_PROGRESS); - } + void EnterCombat(Unit * /*who*/) + { + DoScriptText(YELL_AGGRO, me); - void KilledUnit(Unit* /*victim*/) - { - DoScriptText(RAND(YELL_KILL1,YELL_KILL2,YELL_KILL3), me); - } + if (pInstance) + pInstance->SetData(DATA_BRUTALLUS_EVENT, IN_PROGRESS); + } - void JustDied(Unit* /*Killer*/) - { - DoScriptText(YELL_DEATH, me); + void KilledUnit(Unit* /*victim*/) + { + DoScriptText(RAND(YELL_KILL1,YELL_KILL2,YELL_KILL3), me); + } - if (pInstance) + void JustDied(Unit* /*Killer*/) { - pInstance->SetData(DATA_BRUTALLUS_EVENT, DONE); - float x,y,z; - me->GetPosition(x,y,z); - me->SummonCreature(FELMYST, x,y, z+30, me->GetOrientation(), TEMPSUMMON_MANUAL_DESPAWN, 0); + DoScriptText(YELL_DEATH, me); + + if (pInstance) + { + pInstance->SetData(DATA_BRUTALLUS_EVENT, DONE); + float x,y,z; + me->GetPosition(x,y,z); + me->SummonCreature(FELMYST, x,y, z+30, me->GetOrientation(), TEMPSUMMON_MANUAL_DESPAWN, 0); + } } - } - void EnterEvadeMode() - { - if (!Intro) - ScriptedAI::EnterEvadeMode(); - } + void EnterEvadeMode() + { + if (!Intro) + ScriptedAI::EnterEvadeMode(); + } - void StartIntro() - { - if (!Intro || IsIntro) - return; - sLog.outError("Start Intro"); - Creature *Madrigosa = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_MADRIGOSA) : 0); - if (Madrigosa) + void StartIntro() { - Madrigosa->Respawn(); - Madrigosa->setActive(true); - IsIntro = true; - Madrigosa->SetMaxHealth(me->GetMaxHealth()); - Madrigosa->SetHealth(me->GetMaxHealth()); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->Attack(Madrigosa, true); - Madrigosa->Attack(me, true); - }else + if (!Intro || IsIntro) + return; + sLog.outError("Start Intro"); + Creature *Madrigosa = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_MADRIGOSA) : 0); + if (Madrigosa) + { + Madrigosa->Respawn(); + Madrigosa->setActive(true); + IsIntro = true; + Madrigosa->SetMaxHealth(me->GetMaxHealth()); + Madrigosa->SetHealth(me->GetMaxHealth()); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->Attack(Madrigosa, true); + Madrigosa->Attack(me, true); + }else + { + //Madrigosa not found, end intro + sLog.outError("Madrigosa was not found"); + EndIntro(); + } + } + + void EndIntro() { - //Madrigosa not found, end intro - sLog.outError("Madrigosa was not found"); - EndIntro(); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + Intro = false; + IsIntro = false; + sLog.outError("End Intro"); } - } - void EndIntro() - { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - Intro = false; - IsIntro = false; - sLog.outError("End Intro"); - } + void AttackStart(Unit* pWho) + { + if (!pWho || Intro || IsIntro) + return; + ScriptedAI::AttackStart(pWho); + } - void AttackStart(Unit* pWho) - { - if (!pWho || Intro || IsIntro) - return; - ScriptedAI::AttackStart(pWho); - } + void DoIntro() + { + Creature *Madrigosa = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_MADRIGOSA) : 0); + if (!Madrigosa) + return; - void DoIntro() - { - Creature *Madrigosa = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_MADRIGOSA) : 0); - if (!Madrigosa) - return; + switch (IntroPhase) + { + case 0: + DoScriptText(YELL_MADR_ICE_BARRIER, Madrigosa); + IntroPhaseTimer = 7000; + ++IntroPhase; + break; + case 1: + me->SetInFront(Madrigosa); + Madrigosa->SetInFront(me); + DoScriptText(YELL_MADR_INTRO, Madrigosa, me); + IntroPhaseTimer = 9000; + ++IntroPhase; + break; + case 2: + DoScriptText(YELL_INTRO, me, Madrigosa); + IntroPhaseTimer = 13000; + ++IntroPhase; + break; + case 3: + DoCast(me, SPELL_INTRO_FROST_BLAST); + Madrigosa->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + me->AttackStop(); + Madrigosa->AttackStop(); + IntroFrostBoltTimer = 3000; + IntroPhaseTimer = 28000; + ++IntroPhase; + break; + case 4: + DoScriptText(YELL_INTRO_BREAK_ICE, me); + IntroPhaseTimer = 6000; + ++IntroPhase; + break; + case 5: + Madrigosa->CastSpell(me, SPELL_INTRO_ENCAPSULATE_CHANELLING, false); + DoScriptText(YELL_MADR_TRAP, Madrigosa); + DoCast(me, SPELL_INTRO_ENCAPSULATE); + IntroPhaseTimer = 11000; + ++IntroPhase; + break; + case 6: + DoScriptText(YELL_INTRO_CHARGE, me); + IntroPhaseTimer = 5000; + ++IntroPhase; + break; + case 7: + me->Kill(Madrigosa); + DoScriptText(YELL_MADR_DEATH, Madrigosa); + me->SetHealth(me->GetMaxHealth()); + me->AttackStop(); + IntroPhaseTimer = 4000; + ++IntroPhase; + break; + case 8: + DoScriptText(YELL_INTRO_KILL_MADRIGOSA, me); + me->SetOrientation(0.14f); + me->StopMoving(); + Madrigosa->setDeathState(CORPSE); + IntroPhaseTimer = 8000; + ++IntroPhase; + break; + case 9: + DoScriptText(YELL_INTRO_TAUNT, me); + IntroPhaseTimer = 5000; + ++IntroPhase; + break; + case 10: + EndIntro(); + break; + } + } - switch (IntroPhase) + void MoveInLineOfSight(Unit *who) { - case 0: - DoScriptText(YELL_MADR_ICE_BARRIER, Madrigosa); - IntroPhaseTimer = 7000; - ++IntroPhase; - break; - case 1: - me->SetInFront(Madrigosa); - Madrigosa->SetInFront(me); - DoScriptText(YELL_MADR_INTRO, Madrigosa, me); - IntroPhaseTimer = 9000; - ++IntroPhase; - break; - case 2: - DoScriptText(YELL_INTRO, me, Madrigosa); - IntroPhaseTimer = 13000; - ++IntroPhase; - break; - case 3: - DoCast(me, SPELL_INTRO_FROST_BLAST); - Madrigosa->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); - me->AttackStop(); - Madrigosa->AttackStop(); - IntroFrostBoltTimer = 3000; - IntroPhaseTimer = 28000; - ++IntroPhase; - break; - case 4: - DoScriptText(YELL_INTRO_BREAK_ICE, me); - IntroPhaseTimer = 6000; - ++IntroPhase; - break; - case 5: - Madrigosa->CastSpell(me, SPELL_INTRO_ENCAPSULATE_CHANELLING, false); - DoScriptText(YELL_MADR_TRAP, Madrigosa); - DoCast(me, SPELL_INTRO_ENCAPSULATE); - IntroPhaseTimer = 11000; - ++IntroPhase; - break; - case 6: - DoScriptText(YELL_INTRO_CHARGE, me); - IntroPhaseTimer = 5000; - ++IntroPhase; - break; - case 7: - me->Kill(Madrigosa); - DoScriptText(YELL_MADR_DEATH, Madrigosa); - me->SetHealth(me->GetMaxHealth()); - me->AttackStop(); - IntroPhaseTimer = 4000; - ++IntroPhase; - break; - case 8: - DoScriptText(YELL_INTRO_KILL_MADRIGOSA, me); - me->SetOrientation(0.14f); - me->StopMoving(); - Madrigosa->setDeathState(CORPSE); - IntroPhaseTimer = 8000; - ++IntroPhase; - break; - case 9: - DoScriptText(YELL_INTRO_TAUNT, me); - IntroPhaseTimer = 5000; - ++IntroPhase; - break; - case 10: - EndIntro(); - break; - } - } + if (!who->isTargetableForAttack() || !me->IsHostileTo(who)) + return; + if (pInstance && Intro) + pInstance->SetData(DATA_BRUTALLUS_EVENT, SPECIAL); - void MoveInLineOfSight(Unit *who) - { - if (!who->isTargetableForAttack() || !me->IsHostileTo(who)) - return; - if (pInstance && Intro) - pInstance->SetData(DATA_BRUTALLUS_EVENT, SPECIAL); - - if (Intro && !IsIntro) - StartIntro(); - if (!Intro) - ScriptedAI::MoveInLineOfSight(who); - } + if (Intro && !IsIntro) + StartIntro(); + if (!Intro) + ScriptedAI::MoveInLineOfSight(who); + } - void UpdateAI(const uint32 diff) - { - if (IsIntro) + void UpdateAI(const uint32 diff) { - if (IntroPhaseTimer <= diff) - DoIntro(); - else IntroPhaseTimer -= diff; - - if (IntroPhase == 3 + 1) + if (IsIntro) { - if (IntroFrostBoltTimer <= diff) + if (IntroPhaseTimer <= diff) + DoIntro(); + else IntroPhaseTimer -= diff; + + if (IntroPhase == 3 + 1) { - if (Creature *Madrigosa = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_MADRIGOSA) : 0)) + if (IntroFrostBoltTimer <= diff) { - Madrigosa->CastSpell(me, SPELL_INTRO_FROSTBOLT, true); - IntroFrostBoltTimer = 2000; - } - } else IntroFrostBoltTimer -= diff; + if (Creature *Madrigosa = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_MADRIGOSA) : 0)) + { + Madrigosa->CastSpell(me, SPELL_INTRO_FROSTBOLT, true); + IntroFrostBoltTimer = 2000; + } + } else IntroFrostBoltTimer -= diff; + } + if (!UpdateVictim()) + return; + DoMeleeAttackIfReady(); } - if (!UpdateVictim()) + + if (!UpdateVictim() || IsIntro) return; - DoMeleeAttackIfReady(); - } - if (!UpdateVictim() || IsIntro) - return; + if (SlashTimer <= diff) + { + DoCast(me->getVictim(), SPELL_METEOR_SLASH); + SlashTimer = 11000; + } else SlashTimer -= diff; - if (SlashTimer <= diff) - { - DoCast(me->getVictim(), SPELL_METEOR_SLASH); - SlashTimer = 11000; - } else SlashTimer -= diff; + if (StompTimer <= diff) + { + DoScriptText(RAND(YELL_LOVE1,YELL_LOVE2,YELL_LOVE3), me); + DoCast(me->getVictim(), SPELL_STOMP); + StompTimer = 30000; + } else StompTimer -= diff; - if (StompTimer <= diff) - { - DoScriptText(RAND(YELL_LOVE1,YELL_LOVE2,YELL_LOVE3), me); - DoCast(me->getVictim(), SPELL_STOMP); - StompTimer = 30000; - } else StompTimer -= diff; + if (BurnTimer <= diff) + { + std::list<Unit*> pTargets; + SelectTargetList(pTargets, 10, SELECT_TARGET_RANDOM, 100, true); + for (std::list<Unit*>::const_iterator i = pTargets.begin(); i != pTargets.end(); ++i) + if (!(*i)->HasAura(SPELL_BURN)) + { + (*i)->CastSpell((*i), SPELL_BURN, true); + break; + } + BurnTimer = urand(60000,180000); + } else BurnTimer -= diff; - if (BurnTimer <= diff) - { - std::list<Unit*> pTargets; - SelectTargetList(pTargets, 10, SELECT_TARGET_RANDOM, 100, true); - for (std::list<Unit*>::const_iterator i = pTargets.begin(); i != pTargets.end(); ++i) - if (!(*i)->HasAura(SPELL_BURN)) - { - (*i)->CastSpell((*i), SPELL_BURN, true); - break; - } - BurnTimer = urand(60000,180000); - } else BurnTimer -= diff; + if (BerserkTimer < diff && !Enraged) + { + DoScriptText(YELL_BERSERK, me); + DoCast(me, SPELL_BERSERK); + Enraged = true; + } else BerserkTimer -= diff; - if (BerserkTimer < diff && !Enraged) - { - DoScriptText(YELL_BERSERK, me); - DoCast(me, SPELL_BERSERK); - Enraged = true; - } else BerserkTimer -= diff; + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_brutallus(Creature* pCreature) -{ - return new boss_brutallusAI (pCreature); -} void AddSC_boss_brutallus() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_brutallus"; - newscript->GetAI = &GetAI_boss_brutallus; - newscript->RegisterSelf(); + new boss_brutallus(); } diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp index 6ce5b933d6a..9851c9d919a 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp @@ -84,680 +84,688 @@ enum Spells SPELL_BLAZE_SUMMON = 45236, //187366 GO SPELL_BLAZE_BURN = 45246 }; - -struct boss_sacrolashAI : public ScriptedAI +
class boss_sacrolash : public CreatureScript { - boss_sacrolashAI(Creature *c) : ScriptedAI(c) +public: + boss_sacrolash() : CreatureScript("boss_sacrolash") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); - } + return new boss_sacrolashAI (pCreature); + }; - ScriptedInstance *pInstance; + struct boss_sacrolashAI : public ScriptedAI + { + boss_sacrolashAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } - bool SisterDeath; - bool Enraged; + InstanceScript *pInstance; - uint32 ShadowbladesTimer; - uint32 ShadownovaTimer; - uint32 ConfoundingblowTimer; - uint32 ShadowimageTimer; - uint32 ConflagrationTimer; - uint32 EnrageTimer; + bool SisterDeath; + bool Enraged; - void Reset() - { - Enraged = false; + uint32 ShadowbladesTimer; + uint32 ShadownovaTimer; + uint32 ConfoundingblowTimer; + uint32 ShadowimageTimer; + uint32 ConflagrationTimer; + uint32 EnrageTimer; - if (pInstance) + void Reset() { - Unit* Temp = Unit::GetUnit((*me),pInstance->GetData64(DATA_ALYTHESS)); - if (Temp) - if (Temp->isDead()) - { - CAST_CRE(Temp)->Respawn(); - }else - { - if (Temp->getVictim()) + Enraged = false; + + if (pInstance) + { + Unit* Temp = Unit::GetUnit((*me),pInstance->GetData64(DATA_ALYTHESS)); + if (Temp) + if (Temp->isDead()) + { + CAST_CRE(Temp)->Respawn(); + }else { - me->getThreatManager().addThreat(Temp->getVictim(),0.0f); + if (Temp->getVictim()) + { + me->getThreatManager().addThreat(Temp->getVictim(),0.0f); + } } - } + } + + if (!me->isInCombat()) + { + ShadowbladesTimer = 10000; + ShadownovaTimer = 30000; + ConfoundingblowTimer = 25000; + ShadowimageTimer = 20000; + ConflagrationTimer = 30000; + EnrageTimer = 360000; + + SisterDeath = false; + } + + if (pInstance) + pInstance->SetData(DATA_EREDAR_TWINS_EVENT, NOT_STARTED); } - if (!me->isInCombat()) + void EnterCombat(Unit * who) { - ShadowbladesTimer = 10000; - ShadownovaTimer = 30000; - ConfoundingblowTimer = 25000; - ShadowimageTimer = 20000; - ConflagrationTimer = 30000; - EnrageTimer = 360000; - - SisterDeath = false; - } + DoZoneInCombat(); - if (pInstance) - pInstance->SetData(DATA_EREDAR_TWINS_EVENT, NOT_STARTED); - } + if (pInstance) + { + Unit* Temp = Unit::GetUnit((*me),pInstance->GetData64(DATA_ALYTHESS)); + if (Temp && Temp->isAlive() && !(Temp->getVictim())) + CAST_CRE(Temp)->AI()->AttackStart(who); + } - void EnterCombat(Unit * who) - { - DoZoneInCombat(); + if (pInstance) + pInstance->SetData(DATA_EREDAR_TWINS_EVENT, IN_PROGRESS); + } - if (pInstance) + void KilledUnit(Unit * /*victim*/) { - Unit* Temp = Unit::GetUnit((*me),pInstance->GetData64(DATA_ALYTHESS)); - if (Temp && Temp->isAlive() && !(Temp->getVictim())) - CAST_CRE(Temp)->AI()->AttackStart(who); + if (rand()%4 == 0) + DoScriptText(RAND(YELL_SAC_KILL_1,YELL_SAC_KILL_2), me); } - if (pInstance) - pInstance->SetData(DATA_EREDAR_TWINS_EVENT, IN_PROGRESS); - } - - void KilledUnit(Unit * /*victim*/) - { - if (rand()%4 == 0) - DoScriptText(RAND(YELL_SAC_KILL_1,YELL_SAC_KILL_2), me); - } - - void JustDied(Unit* /*Killer*/) - { - // only if ALY death - if (SisterDeath) + void JustDied(Unit* /*Killer*/) { - DoScriptText(SAY_SAC_DEAD, me); + // only if ALY death + if (SisterDeath) + { + DoScriptText(SAY_SAC_DEAD, me); - if (pInstance) - pInstance->SetData(DATA_EREDAR_TWINS_EVENT, DONE); + if (pInstance) + pInstance->SetData(DATA_EREDAR_TWINS_EVENT, DONE); + } + else + me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); } - else - me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); - } - void SpellHitTarget(Unit *pTarget,const SpellEntry* spell) - { - switch(spell->Id) + void SpellHitTarget(Unit *pTarget,const SpellEntry* spell) { - case SPELL_SHADOW_BLADES: - case SPELL_SHADOW_NOVA: - case SPELL_CONFOUNDING_BLOW: - case SPELL_SHADOW_FURY: - HandleTouchedSpells(pTarget, SPELL_DARK_TOUCHED); - break; - case SPELL_CONFLAGRATION: - HandleTouchedSpells(pTarget, SPELL_FLAME_TOUCHED); - break; + switch(spell->Id) + { + case SPELL_SHADOW_BLADES: + case SPELL_SHADOW_NOVA: + case SPELL_CONFOUNDING_BLOW: + case SPELL_SHADOW_FURY: + HandleTouchedSpells(pTarget, SPELL_DARK_TOUCHED); + break; + case SPELL_CONFLAGRATION: + HandleTouchedSpells(pTarget, SPELL_FLAME_TOUCHED); + break; + } } - } - void HandleTouchedSpells(Unit *pTarget, uint32 TouchedType) - { - switch(TouchedType) + void HandleTouchedSpells(Unit *pTarget, uint32 TouchedType) { - case SPELL_FLAME_TOUCHED: - if (!pTarget->HasAura(SPELL_DARK_FLAME)) + switch(TouchedType) { - if (pTarget->HasAura(SPELL_DARK_TOUCHED)) + case SPELL_FLAME_TOUCHED: + if (!pTarget->HasAura(SPELL_DARK_FLAME)) { - pTarget->RemoveAurasDueToSpell(SPELL_DARK_TOUCHED); - pTarget->CastSpell(pTarget, SPELL_DARK_FLAME, true); - } else pTarget->CastSpell(pTarget, SPELL_FLAME_TOUCHED, true); - } - break; - case SPELL_DARK_TOUCHED: - if (!pTarget->HasAura(SPELL_DARK_FLAME)) - { - if (pTarget->HasAura(SPELL_FLAME_TOUCHED)) + if (pTarget->HasAura(SPELL_DARK_TOUCHED)) + { + pTarget->RemoveAurasDueToSpell(SPELL_DARK_TOUCHED); + pTarget->CastSpell(pTarget, SPELL_DARK_FLAME, true); + } else pTarget->CastSpell(pTarget, SPELL_FLAME_TOUCHED, true); + } + break; + case SPELL_DARK_TOUCHED: + if (!pTarget->HasAura(SPELL_DARK_FLAME)) { - pTarget->RemoveAurasDueToSpell(SPELL_FLAME_TOUCHED); - pTarget->CastSpell(pTarget, SPELL_DARK_FLAME, true); - } else pTarget->CastSpell(pTarget, SPELL_DARK_TOUCHED, true); + if (pTarget->HasAura(SPELL_FLAME_TOUCHED)) + { + pTarget->RemoveAurasDueToSpell(SPELL_FLAME_TOUCHED); + pTarget->CastSpell(pTarget, SPELL_DARK_FLAME, true); + } else pTarget->CastSpell(pTarget, SPELL_DARK_TOUCHED, true); + } + break; } - break; } - } - void UpdateAI(const uint32 diff) - { - if (!SisterDeath) + void UpdateAI(const uint32 diff) { - if (pInstance) + if (!SisterDeath) { - Unit* Temp = NULL; - Temp = Unit::GetUnit((*me),pInstance->GetData64(DATA_ALYTHESS)); - if (Temp && Temp->isDead()) + if (pInstance) { - DoScriptText(YELL_SISTER_ALYTHESS_DEAD, me); - DoCast(me, SPELL_EMPOWER); - me->InterruptSpell(CURRENT_GENERIC_SPELL); - SisterDeath = true; + Unit* Temp = NULL; + Temp = Unit::GetUnit((*me),pInstance->GetData64(DATA_ALYTHESS)); + if (Temp && Temp->isDead()) + { + DoScriptText(YELL_SISTER_ALYTHESS_DEAD, me); + DoCast(me, SPELL_EMPOWER); + me->InterruptSpell(CURRENT_GENERIC_SPELL); + SisterDeath = true; + } } } - } - if (!UpdateVictim()) - return; + if (!UpdateVictim()) + return; - if (SisterDeath) - { - if (ConflagrationTimer <= diff) + if (SisterDeath) + { + if (ConflagrationTimer <= diff) + { + if (!me->IsNonMeleeSpellCasted(false)) + { + me->InterruptSpell(CURRENT_GENERIC_SPELL); + Unit *pTarget = NULL; + pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); + if (pTarget) + DoCast(pTarget, SPELL_CONFLAGRATION); + ConflagrationTimer = 30000+(rand()%5000); + } + } else ConflagrationTimer -= diff; + } + else + { + if (ShadownovaTimer <= diff) + { + if (!me->IsNonMeleeSpellCasted(false)) + { + Unit *pTarget = NULL; + pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); + if (pTarget) + DoCast(pTarget, SPELL_SHADOW_NOVA); + + if (!SisterDeath) + { + if (pTarget) + DoScriptText(EMOTE_SHADOW_NOVA, me, pTarget); + DoScriptText(YELL_SHADOW_NOVA, me); + } + ShadownovaTimer = 30000+(rand()%5000); + } + } else ShadownovaTimer -=diff; + } + + if (ConfoundingblowTimer <= diff) { if (!me->IsNonMeleeSpellCasted(false)) { - me->InterruptSpell(CURRENT_GENERIC_SPELL); Unit *pTarget = NULL; pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); if (pTarget) - DoCast(pTarget, SPELL_CONFLAGRATION); - ConflagrationTimer = 30000+(rand()%5000); + DoCast(pTarget, SPELL_CONFOUNDING_BLOW); + ConfoundingblowTimer = 20000 + (rand()%5000); } - } else ConflagrationTimer -= diff; - } - else - { - if (ShadownovaTimer <= diff) + } else ConfoundingblowTimer -=diff; + + if (ShadowimageTimer <= diff) { - if (!me->IsNonMeleeSpellCasted(false)) + Unit *pTarget = NULL; + Creature* temp = NULL; + for (uint8 i = 0; i<3; ++i) { - Unit *pTarget = NULL; pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); - if (pTarget) - DoCast(pTarget, SPELL_SHADOW_NOVA); - - if (!SisterDeath) + temp = DoSpawnCreature(MOB_SHADOW_IMAGE,0,0,0,0,TEMPSUMMON_CORPSE_DESPAWN,10000); + if (temp && pTarget) { - if (pTarget) - DoScriptText(EMOTE_SHADOW_NOVA, me, pTarget); - DoScriptText(YELL_SHADOW_NOVA, me); + temp->AddThreat(pTarget,1000000);//don't change target(healers) + temp->AI()->AttackStart(pTarget); } - ShadownovaTimer = 30000+(rand()%5000); } - } else ShadownovaTimer -=diff; - } - - if (ConfoundingblowTimer <= diff) - { - if (!me->IsNonMeleeSpellCasted(false)) - { - Unit *pTarget = NULL; - pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); - if (pTarget) - DoCast(pTarget, SPELL_CONFOUNDING_BLOW); - ConfoundingblowTimer = 20000 + (rand()%5000); - } - } else ConfoundingblowTimer -=diff; + ShadowimageTimer = 20000; + } else ShadowimageTimer -=diff; - if (ShadowimageTimer <= diff) - { - Unit *pTarget = NULL; - Creature* temp = NULL; - for (uint8 i = 0; i<3; ++i) + if (ShadowbladesTimer <= diff) { - pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); - temp = DoSpawnCreature(MOB_SHADOW_IMAGE,0,0,0,0,TEMPSUMMON_CORPSE_DESPAWN,10000); - if (temp && pTarget) + if (!me->IsNonMeleeSpellCasted(false)) { - temp->AddThreat(pTarget,1000000);//don't change target(healers) - temp->AI()->AttackStart(pTarget); + DoCast(me, SPELL_SHADOW_BLADES); + ShadowbladesTimer = 10000; } - } - ShadowimageTimer = 20000; - } else ShadowimageTimer -=diff; + } else ShadowbladesTimer -=diff; - if (ShadowbladesTimer <= diff) - { - if (!me->IsNonMeleeSpellCasted(false)) + if (EnrageTimer < diff && !Enraged) { - DoCast(me, SPELL_SHADOW_BLADES); - ShadowbladesTimer = 10000; - } - } else ShadowbladesTimer -=diff; - - if (EnrageTimer < diff && !Enraged) - { - me->InterruptSpell(CURRENT_GENERIC_SPELL); - DoScriptText(YELL_ENRAGE, me); - DoCast(me, SPELL_ENRAGE); - Enraged = true; - } else EnrageTimer -= diff; + me->InterruptSpell(CURRENT_GENERIC_SPELL); + DoScriptText(YELL_ENRAGE, me); + DoCast(me, SPELL_ENRAGE); + Enraged = true; + } else EnrageTimer -= diff; - if (me->isAttackReady() && !me->IsNonMeleeSpellCasted(false)) - { - //If we are within range melee the target - if (me->IsWithinMeleeRange(me->getVictim())) + if (me->isAttackReady() && !me->IsNonMeleeSpellCasted(false)) { - HandleTouchedSpells(me->getVictim(), SPELL_DARK_TOUCHED); - me->AttackerStateUpdate(me->getVictim()); - me->resetAttackTimer(); + //If we are within range melee the target + if (me->IsWithinMeleeRange(me->getVictim())) + { + HandleTouchedSpells(me->getVictim(), SPELL_DARK_TOUCHED); + me->AttackerStateUpdate(me->getVictim()); + me->resetAttackTimer(); + } } } - } -}; + }; -CreatureAI* GetAI_boss_sacrolash(Creature* pCreature) -{ - return new boss_sacrolashAI (pCreature); }; -struct boss_alythessAI : public Scripted_NoMovementAI +
class boss_alythess : public CreatureScript { - boss_alythessAI(Creature *c) : Scripted_NoMovementAI(c) +public: + boss_alythess() : CreatureScript("boss_alythess") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); - IntroStepCounter = 10; - } + return new boss_alythessAI (pCreature); + }; - ScriptedInstance *pInstance; + struct boss_alythessAI : public Scripted_NoMovementAI + { + boss_alythessAI(Creature *c) : Scripted_NoMovementAI(c) + { + pInstance = c->GetInstanceScript(); + IntroStepCounter = 10; + } - bool SisterDeath; - bool Enraged; + InstanceScript *pInstance; - uint32 IntroStepCounter; - uint32 IntroYellTimer; + bool SisterDeath; + bool Enraged; - uint32 ConflagrationTimer; - uint32 BlazeTimer; - uint32 PyrogenicsTimer; - uint32 ShadownovaTimer; - uint32 FlamesearTimer; - uint32 EnrageTimer; + uint32 IntroStepCounter; + uint32 IntroYellTimer; - void Reset() - { - Enraged = false; + uint32 ConflagrationTimer; + uint32 BlazeTimer; + uint32 PyrogenicsTimer; + uint32 ShadownovaTimer; + uint32 FlamesearTimer; + uint32 EnrageTimer; - if (pInstance) + void Reset() { - Unit* Temp = Unit::GetUnit((*me),pInstance->GetData64(DATA_SACROLASH)); - if (Temp) - if (Temp->isDead()) - { - CAST_CRE(Temp)->Respawn(); - }else - { - if (Temp->getVictim()) + Enraged = false; + + if (pInstance) + { + Unit* Temp = Unit::GetUnit((*me),pInstance->GetData64(DATA_SACROLASH)); + if (Temp) + if (Temp->isDead()) + { + CAST_CRE(Temp)->Respawn(); + }else { - me->getThreatManager().addThreat(Temp->getVictim(),0.0f); + if (Temp->getVictim()) + { + me->getThreatManager().addThreat(Temp->getVictim(),0.0f); + } } - } - } + } - if (!me->isInCombat()) - { - ConflagrationTimer = 45000; - BlazeTimer = 100; - PyrogenicsTimer = 15000; - ShadownovaTimer = 40000; - EnrageTimer = 360000; - FlamesearTimer = 15000; - IntroYellTimer = 10000; - - SisterDeath = false; - } + if (!me->isInCombat()) + { + ConflagrationTimer = 45000; + BlazeTimer = 100; + PyrogenicsTimer = 15000; + ShadownovaTimer = 40000; + EnrageTimer = 360000; + FlamesearTimer = 15000; + IntroYellTimer = 10000; - if (pInstance) - pInstance->SetData(DATA_EREDAR_TWINS_EVENT, NOT_STARTED); - } + SisterDeath = false; + } - void EnterCombat(Unit * who) - { - DoZoneInCombat(); + if (pInstance) + pInstance->SetData(DATA_EREDAR_TWINS_EVENT, NOT_STARTED); + } - if (pInstance) + void EnterCombat(Unit * who) { - Unit* Temp = Unit::GetUnit((*me),pInstance->GetData64(DATA_SACROLASH)); - if (Temp && Temp->isAlive() && !(Temp->getVictim())) - CAST_CRE(Temp)->AI()->AttackStart(who); - } + DoZoneInCombat(); + + if (pInstance) + { + Unit* Temp = Unit::GetUnit((*me),pInstance->GetData64(DATA_SACROLASH)); + if (Temp && Temp->isAlive() && !(Temp->getVictim())) + CAST_CRE(Temp)->AI()->AttackStart(who); + } - if (pInstance) - pInstance->SetData(DATA_EREDAR_TWINS_EVENT, IN_PROGRESS); - } + if (pInstance) + pInstance->SetData(DATA_EREDAR_TWINS_EVENT, IN_PROGRESS); + } - void AttackStart(Unit *who) - { - if (!me->isInCombat()) + void AttackStart(Unit *who) { - Scripted_NoMovementAI::AttackStart(who); + if (!me->isInCombat()) + { + Scripted_NoMovementAI::AttackStart(who); + } } - } - - void MoveInLineOfSight(Unit *who) - { - if (!who || me->getVictim()) - return; - if (who->isTargetableForAttack() && who->isInAccessiblePlaceFor(me) && me->IsHostileTo(who)) + void MoveInLineOfSight(Unit *who) { + if (!who || me->getVictim()) + return; - float attackRadius = me->GetAttackDistance(who); - if (me->IsWithinDistInMap(who, attackRadius) && me->GetDistanceZ(who) <= CREATURE_Z_ATTACK_RANGE && me->IsWithinLOSInMap(who)) + if (who->isTargetableForAttack() && who->isInAccessiblePlaceFor(me) && me->IsHostileTo(who)) { - if (!me->isInCombat()) + + float attackRadius = me->GetAttackDistance(who); + if (me->IsWithinDistInMap(who, attackRadius) && me->GetDistanceZ(who) <= CREATURE_Z_ATTACK_RANGE && me->IsWithinLOSInMap(who)) { - DoStartNoMovement(who); + if (!me->isInCombat()) + { + DoStartNoMovement(who); + } } } + else if (IntroStepCounter == 10 && me->IsWithinLOSInMap(who)&& me->IsWithinDistInMap(who, 30)) + { + IntroStepCounter = 0; + } } - else if (IntroStepCounter == 10 && me->IsWithinLOSInMap(who)&& me->IsWithinDistInMap(who, 30)) - { - IntroStepCounter = 0; - } - } - void KilledUnit(Unit * /*victim*/) - { - if (rand()%4 == 0) + void KilledUnit(Unit * /*victim*/) { - DoScriptText(RAND(YELL_ALY_KILL_1,YELL_ALY_KILL_2), me); + if (rand()%4 == 0) + { + DoScriptText(RAND(YELL_ALY_KILL_1,YELL_ALY_KILL_2), me); + } } - } - void JustDied(Unit* /*Killer*/) - { - if (SisterDeath) + void JustDied(Unit* /*Killer*/) { - DoScriptText(YELL_ALY_DEAD, me); + if (SisterDeath) + { + DoScriptText(YELL_ALY_DEAD, me); - if (pInstance) - pInstance->SetData(DATA_EREDAR_TWINS_EVENT, DONE); + if (pInstance) + pInstance->SetData(DATA_EREDAR_TWINS_EVENT, DONE); + } + else + me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); } - else - me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); - } - void SpellHitTarget(Unit *pTarget,const SpellEntry* spell) - { - switch(spell->Id) + void SpellHitTarget(Unit *pTarget,const SpellEntry* spell) { + switch(spell->Id) + { - case SPELL_BLAZE: - pTarget->CastSpell(pTarget, SPELL_BLAZE_SUMMON, true); - case SPELL_CONFLAGRATION: - case SPELL_FLAME_SEAR: - HandleTouchedSpells(pTarget, SPELL_FLAME_TOUCHED); - break; - case SPELL_SHADOW_NOVA: - HandleTouchedSpells(pTarget, SPELL_DARK_TOUCHED); - break; + case SPELL_BLAZE: + pTarget->CastSpell(pTarget, SPELL_BLAZE_SUMMON, true); + case SPELL_CONFLAGRATION: + case SPELL_FLAME_SEAR: + HandleTouchedSpells(pTarget, SPELL_FLAME_TOUCHED); + break; + case SPELL_SHADOW_NOVA: + HandleTouchedSpells(pTarget, SPELL_DARK_TOUCHED); + break; + } } - } - void HandleTouchedSpells(Unit *pTarget, uint32 TouchedType) - { - switch(TouchedType) + void HandleTouchedSpells(Unit *pTarget, uint32 TouchedType) { - case SPELL_FLAME_TOUCHED: - if (!pTarget->HasAura(SPELL_DARK_FLAME)) + switch(TouchedType) { - if (pTarget->HasAura(SPELL_DARK_TOUCHED)) + case SPELL_FLAME_TOUCHED: + if (!pTarget->HasAura(SPELL_DARK_FLAME)) { - pTarget->RemoveAurasDueToSpell(SPELL_DARK_TOUCHED); - pTarget->CastSpell(pTarget, SPELL_DARK_FLAME, true); - }else - { - pTarget->CastSpell(pTarget, SPELL_FLAME_TOUCHED, true); + if (pTarget->HasAura(SPELL_DARK_TOUCHED)) + { + pTarget->RemoveAurasDueToSpell(SPELL_DARK_TOUCHED); + pTarget->CastSpell(pTarget, SPELL_DARK_FLAME, true); + }else + { + pTarget->CastSpell(pTarget, SPELL_FLAME_TOUCHED, true); + } } - } - break; - case SPELL_DARK_TOUCHED: - if (!pTarget->HasAura(SPELL_DARK_FLAME)) - { - if (pTarget->HasAura(SPELL_FLAME_TOUCHED)) + break; + case SPELL_DARK_TOUCHED: + if (!pTarget->HasAura(SPELL_DARK_FLAME)) { - pTarget->RemoveAurasDueToSpell(SPELL_FLAME_TOUCHED); - pTarget->CastSpell(pTarget, SPELL_DARK_FLAME, true); - } else pTarget->CastSpell(pTarget, SPELL_DARK_TOUCHED, true); + if (pTarget->HasAura(SPELL_FLAME_TOUCHED)) + { + pTarget->RemoveAurasDueToSpell(SPELL_FLAME_TOUCHED); + pTarget->CastSpell(pTarget, SPELL_DARK_FLAME, true); + } else pTarget->CastSpell(pTarget, SPELL_DARK_TOUCHED, true); + } + break; } - break; } - } - uint32 IntroStep(uint32 step) - { - Creature* Sacrolash = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_SACROLASH) : 0); - switch (step) + uint32 IntroStep(uint32 step) { - case 0: return 0; - case 1: - if (Sacrolash) - DoScriptText(YELL_INTRO_SAC_1, Sacrolash); - return 1000; - case 2: DoScriptText(YELL_INTRO_ALY_2, me); return 1000; - case 3: - if (Sacrolash) - DoScriptText(YELL_INTRO_SAC_3, Sacrolash); - return 2000; - case 4: DoScriptText(YELL_INTRO_ALY_4, me); return 1000; - case 5: - if (Sacrolash) - DoScriptText(YELL_INTRO_SAC_5, Sacrolash); - return 2000; - case 6: DoScriptText(YELL_INTRO_ALY_6, me); return 1000; - case 7: - if (Sacrolash) - DoScriptText(YELL_INTRO_SAC_7, Sacrolash); - return 3000; - case 8: DoScriptText(YELL_INTRO_ALY_8, me); return 900000; + Creature* Sacrolash = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_SACROLASH) : 0); + switch (step) + { + case 0: return 0; + case 1: + if (Sacrolash) + DoScriptText(YELL_INTRO_SAC_1, Sacrolash); + return 1000; + case 2: DoScriptText(YELL_INTRO_ALY_2, me); return 1000; + case 3: + if (Sacrolash) + DoScriptText(YELL_INTRO_SAC_3, Sacrolash); + return 2000; + case 4: DoScriptText(YELL_INTRO_ALY_4, me); return 1000; + case 5: + if (Sacrolash) + DoScriptText(YELL_INTRO_SAC_5, Sacrolash); + return 2000; + case 6: DoScriptText(YELL_INTRO_ALY_6, me); return 1000; + case 7: + if (Sacrolash) + DoScriptText(YELL_INTRO_SAC_7, Sacrolash); + return 3000; + case 8: DoScriptText(YELL_INTRO_ALY_8, me); return 900000; + } + return 10000; } - return 10000; - } - void UpdateAI(const uint32 diff) - { - if (IntroStepCounter < 9) + void UpdateAI(const uint32 diff) { - if (IntroYellTimer <= diff) + if (IntroStepCounter < 9) { - IntroYellTimer = IntroStep(++IntroStepCounter); - } else IntroYellTimer -= diff; - } + if (IntroYellTimer <= diff) + { + IntroYellTimer = IntroStep(++IntroStepCounter); + } else IntroYellTimer -= diff; + } - if (!SisterDeath) - { - if (pInstance) + if (!SisterDeath) { - Unit* Temp = NULL; - Temp = Unit::GetUnit((*me),pInstance->GetData64(DATA_SACROLASH)); - if (Temp && Temp->isDead()) + if (pInstance) { - DoScriptText(YELL_SISTER_SACROLASH_DEAD, me); - DoCast(me, SPELL_EMPOWER); - me->InterruptSpell(CURRENT_GENERIC_SPELL); - SisterDeath = true; + Unit* Temp = NULL; + Temp = Unit::GetUnit((*me),pInstance->GetData64(DATA_SACROLASH)); + if (Temp && Temp->isDead()) + { + DoScriptText(YELL_SISTER_SACROLASH_DEAD, me); + DoCast(me, SPELL_EMPOWER); + me->InterruptSpell(CURRENT_GENERIC_SPELL); + SisterDeath = true; + } } } - } - if (!me->getVictim()) - { - if (pInstance) + if (!me->getVictim()) { - Creature* sisiter = Unit::GetCreature((*me),pInstance->GetData64(DATA_SACROLASH)); - if (sisiter && !sisiter->isDead() && sisiter->getVictim()) + if (pInstance) { - me->AddThreat(sisiter->getVictim(),0.0f); - DoStartNoMovement(sisiter->getVictim()); - me->Attack(sisiter->getVictim(),false); + Creature* sisiter = Unit::GetCreature((*me),pInstance->GetData64(DATA_SACROLASH)); + if (sisiter && !sisiter->isDead() && sisiter->getVictim()) + { + me->AddThreat(sisiter->getVictim(),0.0f); + DoStartNoMovement(sisiter->getVictim()); + me->Attack(sisiter->getVictim(),false); + } } } - } - if (!UpdateVictim()) - return; + if (!UpdateVictim()) + return; - if (SisterDeath) - { - if (ShadownovaTimer <= diff) + if (SisterDeath) { - if (!me->IsNonMeleeSpellCasted(false)) + if (ShadownovaTimer <= diff) { - Unit *pTarget = NULL; - pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); - if (pTarget) - DoCast(pTarget, SPELL_SHADOW_NOVA); - ShadownovaTimer= 30000+(rand()%5000); - } - } else ShadownovaTimer -=diff; - } - else - { - if (ConflagrationTimer <= diff) + if (!me->IsNonMeleeSpellCasted(false)) + { + Unit *pTarget = NULL; + pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); + if (pTarget) + DoCast(pTarget, SPELL_SHADOW_NOVA); + ShadownovaTimer= 30000+(rand()%5000); + } + } else ShadownovaTimer -=diff; + } + else { - if (!me->IsNonMeleeSpellCasted(false)) + if (ConflagrationTimer <= diff) { - me->InterruptSpell(CURRENT_GENERIC_SPELL); - Unit *pTarget = NULL; - pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); - if (pTarget) - DoCast(pTarget, SPELL_CONFLAGRATION); - ConflagrationTimer = 30000+(rand()%5000); - - if (!SisterDeath) + if (!me->IsNonMeleeSpellCasted(false)) { + me->InterruptSpell(CURRENT_GENERIC_SPELL); + Unit *pTarget = NULL; + pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); if (pTarget) - DoScriptText(EMOTE_CONFLAGRATION, me, pTarget); - DoScriptText(YELL_CANFLAGRATION, me); + DoCast(pTarget, SPELL_CONFLAGRATION); + ConflagrationTimer = 30000+(rand()%5000); + + if (!SisterDeath) + { + if (pTarget) + DoScriptText(EMOTE_CONFLAGRATION, me, pTarget); + DoScriptText(YELL_CANFLAGRATION, me); + } + + BlazeTimer = 4000; } + } else ConflagrationTimer -= diff; + } - BlazeTimer = 4000; + if (FlamesearTimer <= diff) + { + if (!me->IsNonMeleeSpellCasted(false)) + { + DoCast(me, SPELL_FLAME_SEAR); + FlamesearTimer = 15000; } - } else ConflagrationTimer -= diff; - } + } else FlamesearTimer -=diff; - if (FlamesearTimer <= diff) - { - if (!me->IsNonMeleeSpellCasted(false)) + if (PyrogenicsTimer <= diff) { - DoCast(me, SPELL_FLAME_SEAR); - FlamesearTimer = 15000; - } - } else FlamesearTimer -=diff; + if (!me->IsNonMeleeSpellCasted(false)) + { + DoCast(me, SPELL_PYROGENICS, true); + PyrogenicsTimer = 15000; + } + } else PyrogenicsTimer -= diff; - if (PyrogenicsTimer <= diff) - { - if (!me->IsNonMeleeSpellCasted(false)) + if (BlazeTimer <= diff) { - DoCast(me, SPELL_PYROGENICS, true); - PyrogenicsTimer = 15000; - } - } else PyrogenicsTimer -= diff; + if (!me->IsNonMeleeSpellCasted(false)) + { + DoCast(me->getVictim(), SPELL_BLAZE); + BlazeTimer = 3800; + } + } else BlazeTimer -= diff; - if (BlazeTimer <= diff) - { - if (!me->IsNonMeleeSpellCasted(false)) + if (EnrageTimer < diff && !Enraged) { - DoCast(me->getVictim(), SPELL_BLAZE); - BlazeTimer = 3800; - } - } else BlazeTimer -= diff; - - if (EnrageTimer < diff && !Enraged) - { - me->InterruptSpell(CURRENT_GENERIC_SPELL); - DoScriptText(YELL_BERSERK, me); - DoCast(me, SPELL_ENRAGE); - Enraged = true; - } else EnrageTimer -= diff; - } -}; + me->InterruptSpell(CURRENT_GENERIC_SPELL); + DoScriptText(YELL_BERSERK, me); + DoCast(me, SPELL_ENRAGE); + Enraged = true; + } else EnrageTimer -= diff; + } + }; -CreatureAI* GetAI_boss_alythess(Creature* pCreature) -{ - return new boss_alythessAI (pCreature); }; -struct mob_shadow_imageAI : public ScriptedAI +
class mob_shadow_image : public CreatureScript { - mob_shadow_imageAI(Creature *c) : ScriptedAI(c) {} +public: + mob_shadow_image() : CreatureScript("mob_shadow_image") { } - uint32 ShadowfuryTimer; - uint32 KillTimer; - uint32 DarkstrikeTimer; + CreatureAI* GetAI(Creature* pCreature) const + { + return new mob_shadow_imageAI (pCreature); + }; - void Reset() + struct mob_shadow_imageAI : public ScriptedAI { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - ShadowfuryTimer = 5000 + (rand()%15000); - DarkstrikeTimer = 3000; - KillTimer = 15000; - } + mob_shadow_imageAI(Creature *c) : ScriptedAI(c) {} - void EnterCombat(Unit * /*who*/){} + uint32 ShadowfuryTimer; + uint32 KillTimer; + uint32 DarkstrikeTimer; - void SpellHitTarget(Unit *pTarget,const SpellEntry* spell) - { - switch(spell->Id) + void Reset() { + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + ShadowfuryTimer = 5000 + (rand()%15000); + DarkstrikeTimer = 3000; + KillTimer = 15000; + } + + void EnterCombat(Unit * /*who*/){} - case SPELL_SHADOW_FURY: - case SPELL_DARK_STRIKE: - if (!pTarget->HasAura(SPELL_DARK_FLAME)) + void SpellHitTarget(Unit *pTarget,const SpellEntry* spell) + { + switch(spell->Id) { - if (pTarget->HasAura(SPELL_FLAME_TOUCHED)) + + case SPELL_SHADOW_FURY: + case SPELL_DARK_STRIKE: + if (!pTarget->HasAura(SPELL_DARK_FLAME)) { - pTarget->RemoveAurasDueToSpell(SPELL_FLAME_TOUCHED); - pTarget->CastSpell(pTarget, SPELL_DARK_FLAME, true); - } else pTarget->CastSpell(pTarget,SPELL_DARK_TOUCHED,true); + if (pTarget->HasAura(SPELL_FLAME_TOUCHED)) + { + pTarget->RemoveAurasDueToSpell(SPELL_FLAME_TOUCHED); + pTarget->CastSpell(pTarget, SPELL_DARK_FLAME, true); + } else pTarget->CastSpell(pTarget,SPELL_DARK_TOUCHED,true); + } + break; } - break; } - } - void UpdateAI(const uint32 diff) - { - if (!me->HasAura(SPELL_IMAGE_VISUAL)) - DoCast(me, SPELL_IMAGE_VISUAL); - - if (KillTimer <= diff) + void UpdateAI(const uint32 diff) { - me->Kill(me); - KillTimer = 9999999; - } else KillTimer -= diff; + if (!me->HasAura(SPELL_IMAGE_VISUAL)) + DoCast(me, SPELL_IMAGE_VISUAL); + + if (KillTimer <= diff) + { + me->Kill(me); + KillTimer = 9999999; + } else KillTimer -= diff; - if (!UpdateVictim()) - return; + if (!UpdateVictim()) + return; - if (ShadowfuryTimer <= diff) - { - DoCast(me, SPELL_SHADOW_FURY); - ShadowfuryTimer = 10000; - } else ShadowfuryTimer -=diff; + if (ShadowfuryTimer <= diff) + { + DoCast(me, SPELL_SHADOW_FURY); + ShadowfuryTimer = 10000; + } else ShadowfuryTimer -=diff; - if (DarkstrikeTimer <= diff) - { - if (!me->IsNonMeleeSpellCasted(false)) + if (DarkstrikeTimer <= diff) { - //If we are within range melee the target - if (me->IsWithinMeleeRange(me->getVictim())) - DoCast(me->getVictim(), SPELL_DARK_STRIKE); - } - DarkstrikeTimer = 3000; - } else DarkstrikeTimer -= diff; - } -}; + if (!me->IsNonMeleeSpellCasted(false)) + { + //If we are within range melee the target + if (me->IsWithinMeleeRange(me->getVictim())) + DoCast(me->getVictim(), SPELL_DARK_STRIKE); + } + DarkstrikeTimer = 3000; + } else DarkstrikeTimer -= diff; + } + }; -CreatureAI* GetAI_mob_shadow_image(Creature* pCreature) -{ - return new mob_shadow_imageAI (pCreature); }; + void AddSC_boss_eredar_twins() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_sacrolash"; - newscript->GetAI = &GetAI_boss_sacrolash; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_alythess"; - newscript->GetAI = &GetAI_boss_alythess; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_shadow_image"; - newscript->GetAI = &GetAI_mob_shadow_image; - newscript->RegisterSelf(); + new boss_sacrolash(); + new boss_alythess(); + new mob_shadow_image(); } diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp index 3c6efbb97fe..55341d2c2f9 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp @@ -102,479 +102,488 @@ enum EventFelmyst EVENT_SUMMON_DEAD, EVENT_SUMMON_FOG, }; - -struct boss_felmystAI : public ScriptedAI +
class boss_felmyst : public CreatureScript { - boss_felmystAI(Creature *c) : ScriptedAI(c) +public: + boss_felmyst() : CreatureScript("boss_felmyst") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); - - // wait for core patch be accepted - /*SpellEntry *TempSpell = GET_SPELL(SPELL_ENCAPSULATE_EFFECT); - if (TempSpell->SpellIconID == 2294) - TempSpell->SpellIconID = 2295; - TempSpell = GET_SPELL(SPELL_VAPOR_TRIGGER); - if ((TempSpell->Attributes & SPELL_ATTR_PASSIVE) == 0) - TempSpell->Attributes |= SPELL_ATTR_PASSIVE; - TempSpell = GET_SPELL(SPELL_FOG_CHARM2); - if ((TempSpell->Attributes & SPELL_ATTR_PASSIVE) == 0) - TempSpell->Attributes |= SPELL_ATTR_PASSIVE;*/ + return new boss_felmystAI(pCreature); } - ScriptedInstance *pInstance; - PhaseFelmyst phase; - EventMap events; - - uint32 uiFlightCount; - uint32 uiBreathCount; - - float breathX, breathY; - - void Reset() + struct boss_felmystAI : public ScriptedAI { - phase = PHASE_NONE; - - events.Reset(); + boss_felmystAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + + // wait for core patch be accepted + /*SpellEntry *TempSpell = GET_SPELL(SPELL_ENCAPSULATE_EFFECT); + if (TempSpell->SpellIconID == 2294) + TempSpell->SpellIconID = 2295; + TempSpell = GET_SPELL(SPELL_VAPOR_TRIGGER); + if ((TempSpell->Attributes & SPELL_ATTR_PASSIVE) == 0) + TempSpell->Attributes |= SPELL_ATTR_PASSIVE; + TempSpell = GET_SPELL(SPELL_FOG_CHARM2); + if ((TempSpell->Attributes & SPELL_ATTR_PASSIVE) == 0) + TempSpell->Attributes |= SPELL_ATTR_PASSIVE;*/ + } - uiFlightCount = 0; + InstanceScript *pInstance; + PhaseFelmyst phase; + EventMap events; - me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); - me->SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, 10); - me->SetFloatValue(UNIT_FIELD_COMBATREACH, 10); + uint32 uiFlightCount; + uint32 uiBreathCount; - DespawnSummons(MOB_VAPOR_TRAIL); - me->setActive(false); + float breathX, breathY; - if (pInstance) - pInstance->SetData(DATA_FELMYST_EVENT, NOT_STARTED); - } - - void EnterCombat(Unit * /*who*/) - { - events.ScheduleEvent(EVENT_BERSERK, 600000); + void Reset() + { + phase = PHASE_NONE; - me->setActive(true); - DoZoneInCombat(); - DoCast(me, AURA_SUNWELL_RADIANCE, true); - DoCast(me, AURA_NOXIOUS_FUMES, true); - EnterPhase(PHASE_GROUND); + events.Reset(); - if (pInstance) - pInstance->SetData(DATA_FELMYST_EVENT, IN_PROGRESS); - } + uiFlightCount = 0; - void AttackStart(Unit *who) - { - if (phase != PHASE_FLIGHT) - ScriptedAI::AttackStart(who); - } + me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + me->SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, 10); + me->SetFloatValue(UNIT_FIELD_COMBATREACH, 10); - void MoveInLineOfSight(Unit *who) - { - if (phase != PHASE_FLIGHT) - ScriptedAI::MoveInLineOfSight(who); - } + DespawnSummons(MOB_VAPOR_TRAIL); + me->setActive(false); - void KilledUnit(Unit* /*victim*/) - { - DoScriptText(RAND(YELL_KILL1,YELL_KILL2), me); - } + if (pInstance) + pInstance->SetData(DATA_FELMYST_EVENT, NOT_STARTED); + } - void JustRespawned() - { - DoScriptText(YELL_BIRTH, me); - } + void EnterCombat(Unit * /*who*/) + { + events.ScheduleEvent(EVENT_BERSERK, 600000); - void JustDied(Unit* /*Killer*/) - { - DoScriptText(YELL_DEATH, me); + me->setActive(true); + DoZoneInCombat(); + DoCast(me, AURA_SUNWELL_RADIANCE, true); + DoCast(me, AURA_NOXIOUS_FUMES, true); + EnterPhase(PHASE_GROUND); - if (pInstance) - pInstance->SetData(DATA_FELMYST_EVENT, DONE); - } + if (pInstance) + pInstance->SetData(DATA_FELMYST_EVENT, IN_PROGRESS); + } - void SpellHit(Unit *caster, const SpellEntry *spell) - { - // workaround for linked aura - /*if (spell->Id == SPELL_VAPOR_FORCE) - { - caster->CastSpell(caster, SPELL_VAPOR_TRIGGER, true); - }*/ - // workaround for mind control - if (spell->Id == SPELL_FOG_INFORM) + void AttackStart(Unit *who) { - float x, y, z; - caster->GetPosition(x, y, z); - if (Unit* summon = me->SummonCreature(MOB_DEAD, x, y, z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000)) - { - summon->SetMaxHealth(caster->GetMaxHealth()); - summon->SetHealth(caster->GetMaxHealth()); - summon->CastSpell(summon, SPELL_FOG_CHARM, true); - summon->CastSpell(summon, SPELL_FOG_CHARM2, true); - } - me->DealDamage(caster, caster->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + if (phase != PHASE_FLIGHT) + ScriptedAI::AttackStart(who); } - } - void JustSummoned(Creature *summon) - { - if (summon->GetEntry() == MOB_DEAD) + void MoveInLineOfSight(Unit *who) { - summon->AI()->AttackStart(SelectTarget(SELECT_TARGET_RANDOM)); - DoZoneInCombat(summon); - summon->CastSpell(summon, SPELL_DEAD_PASSIVE, true); + if (phase != PHASE_FLIGHT) + ScriptedAI::MoveInLineOfSight(who); } - } - - void MovementInform(uint32, uint32) - { - if (phase == PHASE_FLIGHT) - events.ScheduleEvent(EVENT_FLIGHT_SEQUENCE, 1); - } - - void DamageTaken(Unit*, uint32 &damage) - { - if (phase != PHASE_GROUND && damage >= me->GetHealth()) - damage = 0; - } - void EnterPhase(PhaseFelmyst NextPhase) - { - switch(NextPhase) + void KilledUnit(Unit* /*victim*/) { - case PHASE_GROUND: - me->CastStop(SPELL_FOG_BREATH); - me->RemoveAurasDueToSpell(SPELL_FOG_BREATH); - me->SetUnitMovementFlags(MOVEMENTFLAG_NONE); - me->SetSpeed(MOVE_RUN, 2.0); - - events.ScheduleEvent(EVENT_CLEAVE, urand(5000, 10000)); - events.ScheduleEvent(EVENT_CORROSION, urand(10000, 20000)); - events.ScheduleEvent(EVENT_GAS_NOVA, urand(15000, 20000)); - events.ScheduleEvent(EVENT_ENCAPSULATE, urand(20000, 25000)); - events.ScheduleEvent(EVENT_FLIGHT, 60000); - break; - case PHASE_FLIGHT: - me->SetUnitMovementFlags(MOVEMENTFLAG_LEVITATING); - events.ScheduleEvent(EVENT_FLIGHT_SEQUENCE, 1000); - uiFlightCount = 0; - uiBreathCount = 0; - break; + DoScriptText(RAND(YELL_KILL1,YELL_KILL2), me); } - phase = NextPhase; - } - void HandleFlightSequence() - { - switch(uiFlightCount) + void JustRespawned() { - case 0: - //me->AttackStop(); - me->GetMotionMaster()->Clear(false); - me->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF); - me->StopMoving(); - DoScriptText(YELL_TAKEOFF, me); - events.ScheduleEvent(EVENT_FLIGHT_SEQUENCE, 2000); - break; - case 1: - me->GetMotionMaster()->MovePoint(0, me->GetPositionX()+1, me->GetPositionY(), me->GetPositionZ()+10); - break; - case 2: + DoScriptText(YELL_BIRTH, me); + } + + void JustDied(Unit* /*Killer*/) { - Unit *pTarget = pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 150, true); - if (!pTarget) - pTarget = Unit::GetUnit(*me, pInstance ? pInstance->GetData64(DATA_PLAYER_GUID) : 0); + DoScriptText(YELL_DEATH, me); - if (!pTarget) + if (pInstance) + pInstance->SetData(DATA_FELMYST_EVENT, DONE); + } + + void SpellHit(Unit *caster, const SpellEntry *spell) + { + // workaround for linked aura + /*if (spell->Id == SPELL_VAPOR_FORCE) { - EnterEvadeMode(); - return; + caster->CastSpell(caster, SPELL_VAPOR_TRIGGER, true); + }*/ + // workaround for mind control + if (spell->Id == SPELL_FOG_INFORM) + { + float x, y, z; + caster->GetPosition(x, y, z); + if (Unit* summon = me->SummonCreature(MOB_DEAD, x, y, z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000)) + { + summon->SetMaxHealth(caster->GetMaxHealth()); + summon->SetHealth(caster->GetMaxHealth()); + summon->CastSpell(summon, SPELL_FOG_CHARM, true); + summon->CastSpell(summon, SPELL_FOG_CHARM2, true); + } + me->DealDamage(caster, caster->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); } + } - Creature* Vapor = me->SummonCreature(MOB_VAPOR, pTarget->GetPositionX()-5+rand()%10, pTarget->GetPositionY()-5+rand()%10, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 9000); - if (Vapor) + void JustSummoned(Creature *summon) + { + if (summon->GetEntry() == MOB_DEAD) { - Vapor->AI()->AttackStart(pTarget); - me->InterruptNonMeleeSpells(false); - DoCast(Vapor, SPELL_VAPOR_CHANNEL, false); // core bug - Vapor->CastSpell(Vapor, SPELL_VAPOR_TRIGGER, true); + summon->AI()->AttackStart(SelectTarget(SELECT_TARGET_RANDOM)); + DoZoneInCombat(summon); + summon->CastSpell(summon, SPELL_DEAD_PASSIVE, true); } - - events.ScheduleEvent(EVENT_FLIGHT_SEQUENCE, 10000); - break; } - case 3: + + void MovementInform(uint32, uint32) { - DespawnSummons(MOB_VAPOR_TRAIL); - //DoCast(me, SPELL_VAPOR_SELECT); need core support + if (phase == PHASE_FLIGHT) + events.ScheduleEvent(EVENT_FLIGHT_SEQUENCE, 1); + } - Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 150, true); - if (!pTarget) - pTarget = Unit::GetUnit(*me, pInstance ? pInstance->GetData64(DATA_PLAYER_GUID) : 0); + void DamageTaken(Unit*, uint32 &damage) + { + if (phase != PHASE_GROUND && damage >= me->GetHealth()) + damage = 0; + } - if (!pTarget) + void EnterPhase(PhaseFelmyst NextPhase) + { + switch(NextPhase) { - EnterEvadeMode(); - return; + case PHASE_GROUND: + me->CastStop(SPELL_FOG_BREATH); + me->RemoveAurasDueToSpell(SPELL_FOG_BREATH); + me->SetUnitMovementFlags(MOVEMENTFLAG_NONE); + me->SetSpeed(MOVE_RUN, 2.0); + + events.ScheduleEvent(EVENT_CLEAVE, urand(5000, 10000)); + events.ScheduleEvent(EVENT_CORROSION, urand(10000, 20000)); + events.ScheduleEvent(EVENT_GAS_NOVA, urand(15000, 20000)); + events.ScheduleEvent(EVENT_ENCAPSULATE, urand(20000, 25000)); + events.ScheduleEvent(EVENT_FLIGHT, 60000); + break; + case PHASE_FLIGHT: + me->SetUnitMovementFlags(MOVEMENTFLAG_LEVITATING); + events.ScheduleEvent(EVENT_FLIGHT_SEQUENCE, 1000); + uiFlightCount = 0; + uiBreathCount = 0; + break; } + phase = NextPhase; + } - //pTarget->CastSpell(pTarget, SPELL_VAPOR_SUMMON, true); need core support - Creature* pVapor = me->SummonCreature(MOB_VAPOR, pTarget->GetPositionX()-5+rand()%10, pTarget->GetPositionY()-5+rand()%10, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 9000); - if (pVapor) + void HandleFlightSequence() + { + switch(uiFlightCount) + { + case 0: + //me->AttackStop(); + me->GetMotionMaster()->Clear(false); + me->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF); + me->StopMoving(); + DoScriptText(YELL_TAKEOFF, me); + events.ScheduleEvent(EVENT_FLIGHT_SEQUENCE, 2000); + break; + case 1: + me->GetMotionMaster()->MovePoint(0, me->GetPositionX()+1, me->GetPositionY(), me->GetPositionZ()+10); + break; + case 2: { - if (pVapor->AI()) - pVapor->AI()->AttackStart(pTarget); - me->InterruptNonMeleeSpells(false); - DoCast(pVapor, SPELL_VAPOR_CHANNEL, false); // core bug - pVapor->CastSpell(pVapor, SPELL_VAPOR_TRIGGER, true); + Unit *pTarget = pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 150, true); + if (!pTarget) + pTarget = Unit::GetUnit(*me, pInstance ? pInstance->GetData64(DATA_PLAYER_GUID) : 0); + + if (!pTarget) + { + EnterEvadeMode(); + return; + } + + Creature* Vapor = me->SummonCreature(MOB_VAPOR, pTarget->GetPositionX()-5+rand()%10, pTarget->GetPositionY()-5+rand()%10, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 9000); + if (Vapor) + { + Vapor->AI()->AttackStart(pTarget); + me->InterruptNonMeleeSpells(false); + DoCast(Vapor, SPELL_VAPOR_CHANNEL, false); // core bug + Vapor->CastSpell(Vapor, SPELL_VAPOR_TRIGGER, true); + } + + events.ScheduleEvent(EVENT_FLIGHT_SEQUENCE, 10000); + break; } - - events.ScheduleEvent(EVENT_FLIGHT_SEQUENCE, 10000); - break; - } - case 4: - DespawnSummons(MOB_VAPOR_TRAIL); - events.ScheduleEvent(EVENT_FLIGHT_SEQUENCE, 1); - break; - case 5: - { - Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 150, true); - if (!pTarget) - pTarget = Unit::GetUnit(*me, pInstance ? pInstance->GetData64(DATA_PLAYER_GUID) : 0); - - if (!pTarget) + case 3: { - EnterEvadeMode(); - return; + DespawnSummons(MOB_VAPOR_TRAIL); + //DoCast(me, SPELL_VAPOR_SELECT); need core support + + Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 150, true); + if (!pTarget) + pTarget = Unit::GetUnit(*me, pInstance ? pInstance->GetData64(DATA_PLAYER_GUID) : 0); + + if (!pTarget) + { + EnterEvadeMode(); + return; + } + + //pTarget->CastSpell(pTarget, SPELL_VAPOR_SUMMON, true); need core support + Creature* pVapor = me->SummonCreature(MOB_VAPOR, pTarget->GetPositionX()-5+rand()%10, pTarget->GetPositionY()-5+rand()%10, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 9000); + if (pVapor) + { + if (pVapor->AI()) + pVapor->AI()->AttackStart(pTarget); + me->InterruptNonMeleeSpells(false); + DoCast(pVapor, SPELL_VAPOR_CHANNEL, false); // core bug + pVapor->CastSpell(pVapor, SPELL_VAPOR_TRIGGER, true); + } + + events.ScheduleEvent(EVENT_FLIGHT_SEQUENCE, 10000); + break; } - - breathX = pTarget->GetPositionX(); - breathY = pTarget->GetPositionY(); - float x, y, z; - pTarget->GetContactPoint(me, x, y, z, 70); - me->GetMotionMaster()->MovePoint(0, x, y, z+10); - break; - } - case 6: - me->SetOrientation(me->GetAngle(breathX, breathY)); - me->StopMoving(); - //DoTextEmote("takes a deep breath.", NULL); - events.ScheduleEvent(EVENT_FLIGHT_SEQUENCE, 10000); - break; - case 7: - { - DoCast(me, SPELL_FOG_BREATH, true); - float x, y, z; - me->GetPosition(x, y, z); - x = 2 * breathX - x; - y = 2 * breathY - y; - me->GetMotionMaster()->MovePoint(0, x, y, z); - events.ScheduleEvent(EVENT_SUMMON_FOG, 1); - break; - } - case 8: - me->CastStop(SPELL_FOG_BREATH); - me->RemoveAurasDueToSpell(SPELL_FOG_BREATH); - ++uiBreathCount; - events.ScheduleEvent(EVENT_FLIGHT_SEQUENCE, 1); - if (uiBreathCount < 3) - uiFlightCount = 4; - break; - case 9: - if (Unit *pTarget = SelectTarget(SELECT_TARGET_TOPAGGRO)) - DoStartMovement(pTarget); - else + case 4: + DespawnSummons(MOB_VAPOR_TRAIL); + events.ScheduleEvent(EVENT_FLIGHT_SEQUENCE, 1); + break; + case 5: { - EnterEvadeMode(); - return; + Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 150, true); + if (!pTarget) + pTarget = Unit::GetUnit(*me, pInstance ? pInstance->GetData64(DATA_PLAYER_GUID) : 0); + + if (!pTarget) + { + EnterEvadeMode(); + return; + } + + breathX = pTarget->GetPositionX(); + breathY = pTarget->GetPositionY(); + float x, y, z; + pTarget->GetContactPoint(me, x, y, z, 70); + me->GetMotionMaster()->MovePoint(0, x, y, z+10); + break; } - break; - case 10: - me->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING); - me->HandleEmoteCommand(EMOTE_ONESHOT_LAND); - EnterPhase(PHASE_GROUND); - AttackStart(SelectTarget(SELECT_TARGET_TOPAGGRO)); - break; + case 6: + me->SetOrientation(me->GetAngle(breathX, breathY)); + me->StopMoving(); + //DoTextEmote("takes a deep breath.", NULL); + events.ScheduleEvent(EVENT_FLIGHT_SEQUENCE, 10000); + break; + case 7: + { + DoCast(me, SPELL_FOG_BREATH, true); + float x, y, z; + me->GetPosition(x, y, z); + x = 2 * breathX - x; + y = 2 * breathY - y; + me->GetMotionMaster()->MovePoint(0, x, y, z); + events.ScheduleEvent(EVENT_SUMMON_FOG, 1); + break; + } + case 8: + me->CastStop(SPELL_FOG_BREATH); + me->RemoveAurasDueToSpell(SPELL_FOG_BREATH); + ++uiBreathCount; + events.ScheduleEvent(EVENT_FLIGHT_SEQUENCE, 1); + if (uiBreathCount < 3) + uiFlightCount = 4; + break; + case 9: + if (Unit *pTarget = SelectTarget(SELECT_TARGET_TOPAGGRO)) + DoStartMovement(pTarget); + else + { + EnterEvadeMode(); + return; + } + break; + case 10: + me->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + me->HandleEmoteCommand(EMOTE_ONESHOT_LAND); + EnterPhase(PHASE_GROUND); + AttackStart(SelectTarget(SELECT_TARGET_TOPAGGRO)); + break; + } + ++uiFlightCount; } - ++uiFlightCount; - } - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) + void UpdateAI(const uint32 diff) { - if (phase == PHASE_FLIGHT && !me->IsInEvadeMode()) - EnterEvadeMode(); - return; - } + if (!UpdateVictim()) + { + if (phase == PHASE_FLIGHT && !me->IsInEvadeMode()) + EnterEvadeMode(); + return; + } - events.Update(diff); + events.Update(diff); - if (me->IsNonMeleeSpellCasted(false)) - return; + if (me->IsNonMeleeSpellCasted(false)) + return; - if (phase == PHASE_GROUND) - { - switch(events.ExecuteEvent()) + if (phase == PHASE_GROUND) { - case EVENT_BERSERK: - DoScriptText(YELL_BERSERK, me); - DoCast(me, SPELL_BERSERK, true); - events.ScheduleEvent(EVENT_BERSERK, 10000); - break; - case EVENT_CLEAVE: - DoCast(me->getVictim(), SPELL_CLEAVE, false); - events.ScheduleEvent(EVENT_CLEAVE, urand(5000,10000)); - break; - case EVENT_CORROSION: - DoCast(me->getVictim(), SPELL_CORROSION, false); - events.ScheduleEvent(EVENT_CORROSION, urand(20000,30000)); - break; - case EVENT_GAS_NOVA: - DoCast(me, SPELL_GAS_NOVA, false); - events.ScheduleEvent(EVENT_GAS_NOVA, urand(20000,25000)); - break; - case EVENT_ENCAPSULATE: - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 150, true)) - DoCast(pTarget, SPELL_ENCAPSULATE_CHANNEL, false); - events.ScheduleEvent(EVENT_ENCAPSULATE, urand(25000,30000)); - break; - case EVENT_FLIGHT: - EnterPhase(PHASE_FLIGHT); - break; - default: - DoMeleeAttackIfReady(); - break; + switch(events.ExecuteEvent()) + { + case EVENT_BERSERK: + DoScriptText(YELL_BERSERK, me); + DoCast(me, SPELL_BERSERK, true); + events.ScheduleEvent(EVENT_BERSERK, 10000); + break; + case EVENT_CLEAVE: + DoCast(me->getVictim(), SPELL_CLEAVE, false); + events.ScheduleEvent(EVENT_CLEAVE, urand(5000,10000)); + break; + case EVENT_CORROSION: + DoCast(me->getVictim(), SPELL_CORROSION, false); + events.ScheduleEvent(EVENT_CORROSION, urand(20000,30000)); + break; + case EVENT_GAS_NOVA: + DoCast(me, SPELL_GAS_NOVA, false); + events.ScheduleEvent(EVENT_GAS_NOVA, urand(20000,25000)); + break; + case EVENT_ENCAPSULATE: + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 150, true)) + DoCast(pTarget, SPELL_ENCAPSULATE_CHANNEL, false); + events.ScheduleEvent(EVENT_ENCAPSULATE, urand(25000,30000)); + break; + case EVENT_FLIGHT: + EnterPhase(PHASE_FLIGHT); + break; + default: + DoMeleeAttackIfReady(); + break; + } } - } - if (phase == PHASE_FLIGHT) - { - switch(events.ExecuteEvent()) + if (phase == PHASE_FLIGHT) { - case EVENT_BERSERK: - DoScriptText(YELL_BERSERK, me); - DoCast(me, SPELL_BERSERK, true); - break; - case EVENT_FLIGHT_SEQUENCE: - HandleFlightSequence(); - break; - case EVENT_SUMMON_FOG: - { - float x, y, z; - me->GetPosition(x, y, z); - me->UpdateGroundPositionZ(x, y, z); - if (Creature *Fog = me->SummonCreature(MOB_VAPOR_TRAIL, x, y, z, 0, TEMPSUMMON_TIMED_DESPAWN, 10000)) + switch(events.ExecuteEvent()) + { + case EVENT_BERSERK: + DoScriptText(YELL_BERSERK, me); + DoCast(me, SPELL_BERSERK, true); + break; + case EVENT_FLIGHT_SEQUENCE: + HandleFlightSequence(); + break; + case EVENT_SUMMON_FOG: { - Fog->RemoveAurasDueToSpell(SPELL_TRAIL_TRIGGER); - Fog->CastSpell(Fog, SPELL_FOG_TRIGGER, true); - me->CastSpell(Fog, SPELL_FOG_FORCE, true); + float x, y, z; + me->GetPosition(x, y, z); + me->UpdateGroundPositionZ(x, y, z); + if (Creature *Fog = me->SummonCreature(MOB_VAPOR_TRAIL, x, y, z, 0, TEMPSUMMON_TIMED_DESPAWN, 10000)) + { + Fog->RemoveAurasDueToSpell(SPELL_TRAIL_TRIGGER); + Fog->CastSpell(Fog, SPELL_FOG_TRIGGER, true); + me->CastSpell(Fog, SPELL_FOG_FORCE, true); + } } - } - events.ScheduleEvent(EVENT_SUMMON_FOG, 1000); - break; + events.ScheduleEvent(EVENT_SUMMON_FOG, 1000); + break; + } } } - } - void DespawnSummons(uint32 entry) - { - std::list<Creature*> templist; - float x, y, z; - me->GetPosition(x, y, z); + void DespawnSummons(uint32 entry) + { + std::list<Creature*> templist; + float x, y, z; + me->GetPosition(x, y, z); - CellPair pair(Trinity::ComputeCellPair(x, y)); - Cell cell(pair); - cell.data.Part.reserved = ALL_DISTRICT; - cell.SetNoCreate(); + CellPair pair(Trinity::ComputeCellPair(x, y)); + Cell cell(pair); + cell.data.Part.reserved = ALL_DISTRICT; + cell.SetNoCreate(); - Trinity::AllCreaturesOfEntryInRange check(me, entry, 100); - Trinity::CreatureListSearcher<Trinity::AllCreaturesOfEntryInRange> searcher(me, templist, check); - TypeContainerVisitor<Trinity::CreatureListSearcher<Trinity::AllCreaturesOfEntryInRange>, GridTypeMapContainer> cSearcher(searcher); - cell.Visit(pair, cSearcher, *(me->GetMap())); + Trinity::AllCreaturesOfEntryInRange check(me, entry, 100); + Trinity::CreatureListSearcher<Trinity::AllCreaturesOfEntryInRange> searcher(me, templist, check); + TypeContainerVisitor<Trinity::CreatureListSearcher<Trinity::AllCreaturesOfEntryInRange>, GridTypeMapContainer> cSearcher(searcher); + cell.Visit(pair, cSearcher, *(me->GetMap())); - for (std::list<Creature*>::const_iterator i = templist.begin(); i != templist.end(); ++i) - { - if (entry == MOB_VAPOR_TRAIL && phase == PHASE_FLIGHT) + for (std::list<Creature*>::const_iterator i = templist.begin(); i != templist.end(); ++i) { - (*i)->GetPosition(x, y, z); - me->SummonCreature(MOB_DEAD, x, y, z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); + if (entry == MOB_VAPOR_TRAIL && phase == PHASE_FLIGHT) + { + (*i)->GetPosition(x, y, z); + me->SummonCreature(MOB_DEAD, x, y, z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); + } + (*i)->SetVisibility(VISIBILITY_OFF); + (*i)->setDeathState(JUST_DIED); + if ((*i)->getDeathState() == CORPSE) + (*i)->RemoveCorpse(); } - (*i)->SetVisibility(VISIBILITY_OFF); - (*i)->setDeathState(JUST_DIED); - if ((*i)->getDeathState() == CORPSE) - (*i)->RemoveCorpse(); } - } -}; + }; -struct mob_felmyst_vaporAI : public ScriptedAI +}; +
class mob_felmyst_vapor : public CreatureScript { - mob_felmyst_vaporAI(Creature *c) : ScriptedAI(c) - { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->SetSpeed(MOVE_RUN, 0.8); - } - void Reset() {} - void EnterCombat(Unit* /*who*/) +public: + mob_felmyst_vapor() : CreatureScript("mob_felmyst_vapor") { } + + CreatureAI* GetAI(Creature* pCreature) const { - DoZoneInCombat(); - //DoCast(me, SPELL_VAPOR_FORCE, true); core bug + return new mob_felmyst_vaporAI(pCreature); } - void UpdateAI(const uint32 /*diff*/) + + struct mob_felmyst_vaporAI : public ScriptedAI { - if (!me->getVictim()) - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - AttackStart(pTarget); - } -}; + mob_felmyst_vaporAI(Creature *c) : ScriptedAI(c) + { + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetSpeed(MOVE_RUN, 0.8); + } + void Reset() {} + void EnterCombat(Unit* /*who*/) + { + DoZoneInCombat(); + //DoCast(me, SPELL_VAPOR_FORCE, true); core bug + } + void UpdateAI(const uint32 /*diff*/) + { + if (!me->getVictim()) + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + AttackStart(pTarget); + } + }; -struct mob_felmyst_trailAI : public ScriptedAI +}; +
class mob_felmyst_trail : public CreatureScript { - mob_felmyst_trailAI(Creature *c) : ScriptedAI(c) +public: + mob_felmyst_trail() : CreatureScript("mob_felmyst_trail") { } + + CreatureAI* GetAI(Creature* pCreature) const { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - DoCast(me, SPELL_TRAIL_TRIGGER, true); - me->SetUInt64Value(UNIT_FIELD_TARGET, me->GetGUID()); - me->SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, 0.01); // core bug + return new mob_felmyst_trailAI(pCreature); } - void Reset() {} - void EnterCombat(Unit* /*who*/) {} - void AttackStart(Unit* /*who*/) {} - void MoveInLineOfSight(Unit* /*who*/) {} - void UpdateAI(const uint32 /*diff*/) {} + + struct mob_felmyst_trailAI : public ScriptedAI + { + mob_felmyst_trailAI(Creature *c) : ScriptedAI(c) + { + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + DoCast(me, SPELL_TRAIL_TRIGGER, true); + me->SetUInt64Value(UNIT_FIELD_TARGET, me->GetGUID()); + me->SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, 0.01); // core bug + } + void Reset() {} + void EnterCombat(Unit* /*who*/) {} + void AttackStart(Unit* /*who*/) {} + void MoveInLineOfSight(Unit* /*who*/) {} + void UpdateAI(const uint32 /*diff*/) {} + }; + }; -CreatureAI* GetAI_boss_felmyst(Creature* pCreature) -{ - return new boss_felmystAI(pCreature); -} -CreatureAI* GetAI_mob_felmyst_vapor(Creature* pCreature) -{ - return new mob_felmyst_vaporAI(pCreature); -} -CreatureAI* GetAI_mob_felmyst_trail(Creature* pCreature) -{ - return new mob_felmyst_trailAI(pCreature); -} void AddSC_boss_felmyst() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_felmyst"; - newscript->GetAI = &GetAI_boss_felmyst; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_felmyst_vapor"; - newscript->GetAI = &GetAI_mob_felmyst_vapor; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_felmyst_trail"; - newscript->GetAI = &GetAI_mob_felmyst_trail; - newscript->RegisterSelf(); + new boss_felmyst(); + new mob_felmyst_vapor(); + new mob_felmyst_trail(); } diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp index 61def91b736..5660ccf98ac 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp @@ -102,695 +102,704 @@ enum SWPActions #define MAX_PLAYERS_IN_SPECTRAL_REALM 0 //over this, teleport object won't work, 0 disables check uint32 WildMagic[] = { 44978, 45001, 45002, 45004, 45006, 45010 }; - -struct boss_kalecgosAI : public ScriptedAI +
class boss_kalecgos : public CreatureScript { - boss_kalecgosAI(Creature *c) : ScriptedAI(c) +public: + boss_kalecgos() : CreatureScript("boss_kalecgos") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); - SathGUID = 0; - DoorGUID = 0; - bJustReset = false; - me->setActive(true); - SpellEntry *TempSpell = GET_SPELL(SPELL_SPECTRAL_BLAST); - if (TempSpell) - TempSpell->EffectImplicitTargetB[0] = TARGET_UNIT_TARGET_ENEMY; + return new boss_kalecgosAI (pCreature); } - ScriptedInstance *pInstance; + struct boss_kalecgosAI : public ScriptedAI + { + boss_kalecgosAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + SathGUID = 0; + DoorGUID = 0; + bJustReset = false; + me->setActive(true); + SpellEntry *TempSpell = GET_SPELL(SPELL_SPECTRAL_BLAST); + if (TempSpell) + TempSpell->EffectImplicitTargetB[0] = TARGET_UNIT_TARGET_ENEMY; + } - uint32 ArcaneBuffetTimer; - uint32 FrostBreathTimer; - uint32 WildMagicTimer; - uint32 SpectralBlastTimer; - uint32 TailLashTimer; - uint32 CheckTimer; - uint32 TalkTimer; - uint32 TalkSequence; - uint32 ResetTimer; + InstanceScript *pInstance; - bool isFriendly; - bool isEnraged; - bool isBanished; - bool bJustReset; + uint32 ArcaneBuffetTimer; + uint32 FrostBreathTimer; + uint32 WildMagicTimer; + uint32 SpectralBlastTimer; + uint32 TailLashTimer; + uint32 CheckTimer; + uint32 TalkTimer; + uint32 TalkSequence; + uint32 ResetTimer; - uint64 SathGUID; - uint64 DoorGUID; + bool isFriendly; + bool isEnraged; + bool isBanished; + bool bJustReset; - void Reset() - { - if (pInstance) + uint64 SathGUID; + uint64 DoorGUID; + + void Reset() { - SathGUID = pInstance->GetData64(DATA_SATHROVARR); - pInstance->SetData(DATA_KALECGOS_EVENT, NOT_STARTED); - } + if (pInstance) + { + SathGUID = pInstance->GetData64(DATA_SATHROVARR); + pInstance->SetData(DATA_KALECGOS_EVENT, NOT_STARTED); + } - if (Creature *Sath = Unit::GetCreature(*me, SathGUID)) - Sath->AI()->EnterEvadeMode(); + if (Creature *Sath = Unit::GetCreature(*me, SathGUID)) + Sath->AI()->EnterEvadeMode(); - me->setFaction(14); - if (!bJustReset) //first reset at create - { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE + UNIT_FLAG_NOT_SELECTABLE); - me->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING); - me->SetVisibility(VISIBILITY_ON); - me->SetStandState(UNIT_STAND_STATE_SLEEP); - } - me->SetHealth(me->GetMaxHealth());//dunno why it does not resets health at evade.. - ArcaneBuffetTimer = 8000; - FrostBreathTimer = 15000; - WildMagicTimer = 10000; - TailLashTimer = 25000; - SpectralBlastTimer = urand(20000,25000); - CheckTimer = 1000; - ResetTimer = 30000; - - TalkTimer = 0; - TalkSequence = 0; - isFriendly = false; - isEnraged = false; - isBanished = false; - } + me->setFaction(14); + if (!bJustReset) //first reset at create + { + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE + UNIT_FLAG_NOT_SELECTABLE); + me->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + me->SetVisibility(VISIBILITY_ON); + me->SetStandState(UNIT_STAND_STATE_SLEEP); + } + me->SetHealth(me->GetMaxHealth());//dunno why it does not resets health at evade.. + ArcaneBuffetTimer = 8000; + FrostBreathTimer = 15000; + WildMagicTimer = 10000; + TailLashTimer = 25000; + SpectralBlastTimer = urand(20000,25000); + CheckTimer = 1000; + ResetTimer = 30000; - void EnterEvadeMode() - { - bJustReset = true; - me->SetVisibility(VISIBILITY_OFF); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE + UNIT_FLAG_NOT_SELECTABLE); - ScriptedAI::EnterEvadeMode(); - } + TalkTimer = 0; + TalkSequence = 0; + isFriendly = false; + isEnraged = false; + isBanished = false; + } - void DoAction(const int32 param) - { - switch (param) + void EnterEvadeMode() { - case DO_ENRAGE: - isEnraged = true; - me->CastSpell(me, SPELL_ENRAGE, true); - break; - case DO_BANISH: - isBanished = true; - me->CastSpell(me, SPELL_BANISH, true); - break; + bJustReset = true; + me->SetVisibility(VISIBILITY_OFF); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE + UNIT_FLAG_NOT_SELECTABLE); + ScriptedAI::EnterEvadeMode(); } - } - void UpdateAI(const uint32 diff) - { - if (TalkTimer) + void DoAction(const int32 param) { - if (!TalkSequence) + switch (param) { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE + UNIT_FLAG_NOT_SELECTABLE); - me->InterruptNonMeleeSpells(true); - me->RemoveAllAuras(); - me->DeleteThreatList(); - me->CombatStop(); - ++TalkSequence; + case DO_ENRAGE: + isEnraged = true; + me->CastSpell(me, SPELL_ENRAGE, true); + break; + case DO_BANISH: + isBanished = true; + me->CastSpell(me, SPELL_BANISH, true); + break; } - if (TalkTimer <= diff) - { - if (isFriendly) - GoodEnding(); - else - BadEnding(); - ++TalkSequence; - } else TalkTimer -= diff; } - else + + void UpdateAI(const uint32 diff) { - if (bJustReset) + if (TalkTimer) { - if (ResetTimer <= diff) + if (!TalkSequence) { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE); - me->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING); - me->SetVisibility(VISIBILITY_ON); - me->SetStandState(UNIT_STAND_STATE_SLEEP); - ResetTimer = 10000; - bJustReset = false; - } else ResetTimer -= diff; - return; + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE + UNIT_FLAG_NOT_SELECTABLE); + me->InterruptNonMeleeSpells(true); + me->RemoveAllAuras(); + me->DeleteThreatList(); + me->CombatStop(); + ++TalkSequence; + } + if (TalkTimer <= diff) + { + if (isFriendly) + GoodEnding(); + else + BadEnding(); + ++TalkSequence; + } else TalkTimer -= diff; } - if (!UpdateVictim()) - return; - - if (CheckTimer <= diff) + else { - if (me->GetDistance(CENTER_X, CENTER_Y, DRAGON_REALM_Z) >= 75) + if (bJustReset) { - me->AI()->EnterEvadeMode(); + if (ResetTimer <= diff) + { + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE); + me->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + me->SetVisibility(VISIBILITY_ON); + me->SetStandState(UNIT_STAND_STATE_SLEEP); + ResetTimer = 10000; + bJustReset = false; + } else ResetTimer -= diff; return; } - if (HealthBelowPct(10) && !isEnraged) - { - if (Creature* Sath = Unit::GetCreature(*me, SathGUID)) - Sath->AI()->DoAction(DO_ENRAGE); - DoAction(DO_ENRAGE); - } - if (!isBanished && HealthBelowPct(1)) + if (!UpdateVictim()) + return; + + if (CheckTimer <= diff) { - if (Creature* Sath = Unit::GetCreature(*me, SathGUID)) + if (me->GetDistance(CENTER_X, CENTER_Y, DRAGON_REALM_Z) >= 75) + { + me->AI()->EnterEvadeMode(); + return; + } + if (HealthBelowPct(10) && !isEnraged) + { + if (Creature* Sath = Unit::GetCreature(*me, SathGUID)) + Sath->AI()->DoAction(DO_ENRAGE); + DoAction(DO_ENRAGE); + } + if (!isBanished && HealthBelowPct(1)) { - if (Sath->HasAura(SPELL_BANISH)) + if (Creature* Sath = Unit::GetCreature(*me, SathGUID)) { - Sath->DealDamage(Sath, Sath->GetHealth()); - return; + if (Sath->HasAura(SPELL_BANISH)) + { + Sath->DealDamage(Sath, Sath->GetHealth()); + return; + } + else + DoAction(DO_BANISH); } else - DoAction(DO_BANISH); - } - else - { - sLog.outError("TSCR: Didn't find Shathrowar. Kalecgos event reseted."); - EnterEvadeMode(); - return; + { + sLog.outError("TSCR: Didn't find Shathrowar. Kalecgos event reseted."); + EnterEvadeMode(); + return; + } } - } - CheckTimer = 1000; - } else CheckTimer -= diff; - - if (ArcaneBuffetTimer <= diff) - { - DoCastAOE(SPELL_ARCANE_BUFFET); - ArcaneBuffetTimer = 8000; - } else ArcaneBuffetTimer -= diff; + CheckTimer = 1000; + } else CheckTimer -= diff; - if (FrostBreathTimer <= diff) - { - DoCastAOE(SPELL_FROST_BREATH); - FrostBreathTimer = 15000; - } else FrostBreathTimer -= diff; + if (ArcaneBuffetTimer <= diff) + { + DoCastAOE(SPELL_ARCANE_BUFFET); + ArcaneBuffetTimer = 8000; + } else ArcaneBuffetTimer -= diff; - if (TailLashTimer <= diff) - { - DoCastAOE(SPELL_TAIL_LASH); - TailLashTimer = 15000; - } else TailLashTimer -= diff; + if (FrostBreathTimer <= diff) + { + DoCastAOE(SPELL_FROST_BREATH); + FrostBreathTimer = 15000; + } else FrostBreathTimer -= diff; - if (WildMagicTimer <= diff) - { - DoCastAOE(WildMagic[rand()%6]); - WildMagicTimer = 20000; - } else WildMagicTimer -= diff; + if (TailLashTimer <= diff) + { + DoCastAOE(SPELL_TAIL_LASH); + TailLashTimer = 15000; + } else TailLashTimer -= diff; - if (SpectralBlastTimer <= diff) - { - std::list<HostileReference*> &m_threatlist = me->getThreatManager().getThreatList(); - std::list<Unit*> targetList; - for (std::list<HostileReference*>::const_iterator itr = m_threatlist.begin(); itr!= m_threatlist.end(); ++itr) - if ((*itr)->getTarget() && (*itr)->getTarget()->GetTypeId() == TYPEID_PLAYER && (*itr)->getTarget()->GetGUID() != me->getVictim()->GetGUID() && !(*itr)->getTarget()->HasAura(AURA_SPECTRAL_EXHAUSTION) && (*itr)->getTarget()->GetPositionZ() > me->GetPositionZ()-5) - targetList.push_back((*itr)->getTarget()); - if (targetList.empty()) + if (WildMagicTimer <= diff) { - SpectralBlastTimer = 1000; - return; - } - std::list<Unit*>::const_iterator i = targetList.begin(); - advance(i, rand()%targetList.size()); - if ((*i)) + DoCastAOE(WildMagic[rand()%6]); + WildMagicTimer = 20000; + } else WildMagicTimer -= diff; + + if (SpectralBlastTimer <= diff) { - (*i)->CastSpell((*i), SPELL_SPECTRAL_BLAST,true); - SpectralBlastTimer = 20000+rand()%5000; - } else SpectralBlastTimer = 1000; - } else SpectralBlastTimer -= diff; + std::list<HostileReference*> &m_threatlist = me->getThreatManager().getThreatList(); + std::list<Unit*> targetList; + for (std::list<HostileReference*>::const_iterator itr = m_threatlist.begin(); itr!= m_threatlist.end(); ++itr) + if ((*itr)->getTarget() && (*itr)->getTarget()->GetTypeId() == TYPEID_PLAYER && (*itr)->getTarget()->GetGUID() != me->getVictim()->GetGUID() && !(*itr)->getTarget()->HasAura(AURA_SPECTRAL_EXHAUSTION) && (*itr)->getTarget()->GetPositionZ() > me->GetPositionZ()-5) + targetList.push_back((*itr)->getTarget()); + if (targetList.empty()) + { + SpectralBlastTimer = 1000; + return; + } + std::list<Unit*>::const_iterator i = targetList.begin(); + advance(i, rand()%targetList.size()); + if ((*i)) + { + (*i)->CastSpell((*i), SPELL_SPECTRAL_BLAST,true); + SpectralBlastTimer = 20000+rand()%5000; + } else SpectralBlastTimer = 1000; + } else SpectralBlastTimer -= diff; - DoMeleeAttackIfReady(); + DoMeleeAttackIfReady(); + } } - } - - void MoveInLineOfSight(Unit *who) - { - if (bJustReset)//boss is invisible, don't attack - return; - if (!me->getVictim() && who->isTargetableForAttack() && (me->IsHostileTo(who))) + void MoveInLineOfSight(Unit *who) { - float attackRadius = me->GetAttackDistance(who); - if (me->IsWithinDistInMap(who, attackRadius)) - AttackStart(who); - } - } + if (bJustReset)//boss is invisible, don't attack + return; - void DamageTaken(Unit *done_by, uint32 &damage) - { - if (damage >= me->GetHealth() && done_by != me) - damage = 0; - } + if (!me->getVictim() && who->isTargetableForAttack() && (me->IsHostileTo(who))) + { + float attackRadius = me->GetAttackDistance(who); + if (me->IsWithinDistInMap(who, attackRadius)) + AttackStart(who); + } + } - void EnterCombat(Unit* /*who*/) - { - me->SetStandState(UNIT_STAND_STATE_STAND); - DoScriptText(SAY_EVIL_AGGRO, me); - DoZoneInCombat(); + void DamageTaken(Unit *done_by, uint32 &damage) + { + if (damage >= me->GetHealth() && done_by != me) + damage = 0; + } - if (pInstance) - pInstance->SetData(DATA_KALECGOS_EVENT, IN_PROGRESS); - } + void EnterCombat(Unit* /*who*/) + { + me->SetStandState(UNIT_STAND_STATE_STAND); + DoScriptText(SAY_EVIL_AGGRO, me); + DoZoneInCombat(); - void KilledUnit(Unit * /*victim*/) - { - DoScriptText(RAND(SAY_EVIL_SLAY1,SAY_EVIL_SLAY2), me); - } + if (pInstance) + pInstance->SetData(DATA_KALECGOS_EVENT, IN_PROGRESS); + } - void MovementInform(uint32 type,uint32 /*id*/) - { - if (type != POINT_MOTION_TYPE) - return; - me->SetVisibility(VISIBILITY_OFF); - if (isFriendly) + void KilledUnit(Unit * /*victim*/) { - me->setDeathState(JUST_DIED); + DoScriptText(RAND(SAY_EVIL_SLAY1,SAY_EVIL_SLAY2), me); + } - Map::PlayerList const& players = me->GetMap()->GetPlayers(); - if (!players.isEmpty()) + void MovementInform(uint32 type,uint32 /*id*/) + { + if (type != POINT_MOTION_TYPE) + return; + me->SetVisibility(VISIBILITY_OFF); + if (isFriendly) { - for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + me->setDeathState(JUST_DIED); + + Map::PlayerList const& players = me->GetMap()->GetPlayers(); + if (!players.isEmpty()) { - Player* pPlayer = itr->getSource(); - if (pPlayer) - me->GetMap()->ToInstanceMap()->PermBindAllPlayers(pPlayer); + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + { + Player* pPlayer = itr->getSource(); + if (pPlayer) + me->GetMap()->ToInstanceMap()->PermBindAllPlayers(pPlayer); + } } } + else + { + me->GetMotionMaster()->MoveTargetedHome(); + TalkTimer = 1000; + } } - else - { - me->GetMotionMaster()->MoveTargetedHome(); - TalkTimer = 1000; - } - } - void GoodEnding() - { - switch(TalkSequence) + void GoodEnding() { - case 1: - me->setFaction(35); - TalkTimer = 1000; - break; - case 2: - DoScriptText(SAY_GOOD_PLRWIN, me); - TalkTimer = 10000; - break; - case 3: - me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); - me->GetMotionMaster()->MovePoint(0,FLY_X,FLY_Y,FLY_Z); - TalkTimer = 600000; - break; - default: - break; + switch(TalkSequence) + { + case 1: + me->setFaction(35); + TalkTimer = 1000; + break; + case 2: + DoScriptText(SAY_GOOD_PLRWIN, me); + TalkTimer = 10000; + break; + case 3: + me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + me->GetMotionMaster()->MovePoint(0,FLY_X,FLY_Y,FLY_Z); + TalkTimer = 600000; + break; + default: + break; + } } - } - void BadEnding() - { - switch(TalkSequence) + void BadEnding() { - case 1: - DoScriptText(SAY_EVIL_ENRAGE, me); - TalkTimer = 3000; - break; - case 2: - me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); - me->GetMotionMaster()->MovePoint(0,FLY_X,FLY_Y,FLY_Z); - TalkTimer = 15000; - break; - case 3: - EnterEvadeMode(); - break; - default: - break; + switch(TalkSequence) + { + case 1: + DoScriptText(SAY_EVIL_ENRAGE, me); + TalkTimer = 3000; + break; + case 2: + me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + me->GetMotionMaster()->MovePoint(0,FLY_X,FLY_Y,FLY_Z); + TalkTimer = 15000; + break; + case 3: + EnterEvadeMode(); + break; + default: + break; + } } - } -}; + }; -struct boss_sathrovarrAI : public ScriptedAI +}; +
class boss_kalec : public CreatureScript { - boss_sathrovarrAI(Creature *c) : ScriptedAI(c) +public: + boss_kalec() : CreatureScript("boss_kalec") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); - KalecGUID = 0; - KalecgosGUID = 0; + return new boss_kalecAI (pCreature); } - ScriptedInstance *pInstance; + struct boss_kalecAI : public ScriptedAI + { + InstanceScript *pInstance; - uint32 CorruptionStrikeTimer; - uint32 AgonyCurseTimer; - uint32 ShadowBoltTimer; - uint32 CheckTimer; - uint32 ResetThreat; + uint32 RevitalizeTimer; + uint32 HeroicStrikeTimer; + uint32 YellTimer; + uint32 YellSequence; - uint64 KalecGUID; - uint64 KalecgosGUID; + uint64 SathGUID; - bool isEnraged; - bool isBanished; + bool isEnraged; // if demon is enraged - void Reset() - { - me->SetHealth(me->GetMaxHealth());//dunno why it does not resets health at evade.. - me->setActive(true); - if (pInstance) + boss_kalecAI(Creature *c) : ScriptedAI(c) { - KalecgosGUID = pInstance->GetData64(DATA_KALECGOS_DRAGON); - pInstance->SetData(DATA_KALECGOS_EVENT, NOT_STARTED); + pInstance = c->GetInstanceScript(); } - if (KalecGUID) + + void Reset() { - if (Creature* Kalec = Unit::GetCreature(*me, KalecGUID)) - Kalec->setDeathState(JUST_DIED); - KalecGUID = 0; - } + if (pInstance) + SathGUID = pInstance->GetData64(DATA_SATHROVARR); - ShadowBoltTimer = 7000 + rand()%3 * 1000; - AgonyCurseTimer = 20000; - CorruptionStrikeTimer = 13000; - CheckTimer = 1000; - ResetThreat = 1000; - isEnraged = false; - isBanished = false; + RevitalizeTimer = 5000; + HeroicStrikeTimer = 3000; + YellTimer = 5000; + YellSequence = 0; - me->CastSpell(me, AURA_DEMONIC_VISUAL, true); - TeleportAllPlayersBack(); - } + isEnraged = false; + } - void EnterCombat(Unit* /*who*/) - { - if (Creature *Kalec = me->SummonCreature(MOB_KALEC, me->GetPositionX() + 10, me->GetPositionY() + 5, me->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 0)) + void DamageTaken(Unit *done_by, uint32 &damage) { - KalecGUID = Kalec->GetGUID(); - me->CombatStart(Kalec); - me->AddThreat(Kalec, 100.0f); - Kalec->setActive(true); + if (done_by->GetGUID() != SathGUID) + damage = 0; + else if (isEnraged) + damage *= 3; } - DoScriptText(SAY_SATH_AGGRO, me); - } - void DamageTaken(Unit *done_by, uint32 &damage) - { - if (damage >= me->GetHealth() && done_by != me) - damage = 0; - } - - void KilledUnit(Unit *pTarget) - { - if (pTarget->GetGUID() == KalecGUID) + void UpdateAI(const uint32 diff) { - TeleportAllPlayersBack(); - if (Creature *Kalecgos = Unit::GetCreature(*me, KalecgosGUID)) + if (!me->HasAura(AURA_SPECTRAL_INVISIBILITY)) + me->CastSpell(me, AURA_SPECTRAL_INVISIBILITY, true); + if (!UpdateVictim()) + return; + + if (YellTimer <= diff) { - CAST_AI(boss_kalecgosAI, Kalecgos->AI())->TalkTimer = 1; - CAST_AI(boss_kalecgosAI, Kalecgos->AI())->isFriendly = false; + switch(YellSequence) + { + case 0: + DoScriptText(SAY_GOOD_AGGRO, me); + ++YellSequence; + break; + case 1: + if (HealthBelowPct(50)) + { + DoScriptText(SAY_GOOD_NEAR_DEATH, me); + ++YellSequence; + } + break; + case 2: + if (HealthBelowPct(10)) + { + DoScriptText(SAY_GOOD_NEAR_DEATH2, me); + ++YellSequence; + } + break; + default: + break; + } + YellTimer = 5000; } - EnterEvadeMode(); - return; + + if (RevitalizeTimer <= diff) + { + DoCast(me, SPELL_REVITALIZE); + RevitalizeTimer = 5000; + } else RevitalizeTimer -= diff; + + if (HeroicStrikeTimer <= diff) + { + DoCast(me->getVictim(), SPELL_HEROIC_STRIKE); + HeroicStrikeTimer = 2000; + } else HeroicStrikeTimer -= diff; + + DoMeleeAttackIfReady(); } - DoScriptText(RAND(SAY_SATH_SLAY1,SAY_SATH_SLAY2), me); - } + }; + +}; +
class kalecgos_teleporter : public GameObjectScript +{ +public: + kalecgos_teleporter() : GameObjectScript("kalecgos_teleporter") { } - void JustDied(Unit * /*killer*/) + bool OnGossipHello(Player* pPlayer, GameObject* pGo) { - DoScriptText(SAY_SATH_DEATH, me); - me->GetMap()->CreatureRelocation(me, me->GetPositionX(), me->GetPositionY(), DRAGON_REALM_Z, me->GetOrientation()); - TeleportAllPlayersBack(); - if (Creature *Kalecgos = Unit::GetCreature(*me, KalecgosGUID)) + uint32 SpectralPlayers = 0; + Map* pMap = pGo->GetMap(); + if (!pMap->IsDungeon()) return true; + Map::PlayerList const &PlayerList = pMap->GetPlayers(); + for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) { - CAST_AI(boss_kalecgosAI, Kalecgos->AI())->TalkTimer = 1; - CAST_AI(boss_kalecgosAI, Kalecgos->AI())->isFriendly = true; + if (i->getSource() && i->getSource()->GetPositionZ() < DEMON_REALM_Z + 5) + ++SpectralPlayers; } + if (pPlayer->HasAura(AURA_SPECTRAL_EXHAUSTION) || (MAX_PLAYERS_IN_SPECTRAL_REALM && SpectralPlayers >= MAX_PLAYERS_IN_SPECTRAL_REALM)) + pPlayer->GetSession()->SendNotification(GO_FAILED); + else + pPlayer->CastSpell(pPlayer, SPELL_TELEPORT_SPECTRAL, true); + return true; + } - if (pInstance) - pInstance->SetData(DATA_KALECGOS_EVENT, DONE); +}; +
class boss_sathrovarr : public CreatureScript +{ +public: + boss_sathrovarr() : CreatureScript("boss_sathrovarr") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_sathrovarrAI (pCreature); } - void TeleportAllPlayersBack() + struct boss_sathrovarrAI : public ScriptedAI { - Map* pMap = me->GetMap(); - if (!pMap->IsDungeon()) return; - Map::PlayerList const &PlayerList = pMap->GetPlayers(); - for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) + boss_sathrovarrAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + KalecGUID = 0; + KalecgosGUID = 0; + } + + InstanceScript *pInstance; + + uint32 CorruptionStrikeTimer; + uint32 AgonyCurseTimer; + uint32 ShadowBoltTimer; + uint32 CheckTimer; + uint32 ResetThreat; + + uint64 KalecGUID; + uint64 KalecgosGUID; + + bool isEnraged; + bool isBanished; + + void Reset() { - if (i->getSource()->GetPositionZ() <= DRAGON_REALM_Z-5) + me->SetHealth(me->GetMaxHealth());//dunno why it does not resets health at evade.. + me->setActive(true); + if (pInstance) { - i->getSource()->RemoveAura(AURA_SPECTRAL_REALM); - i->getSource()->TeleportTo(me->GetMap()->GetId(),i->getSource()->GetPositionX(),i->getSource()->GetPositionY(),DRAGON_REALM_Z+5,i->getSource()->GetOrientation()); + KalecgosGUID = pInstance->GetData64(DATA_KALECGOS_DRAGON); + pInstance->SetData(DATA_KALECGOS_EVENT, NOT_STARTED); } + if (KalecGUID) + { + if (Creature* Kalec = Unit::GetCreature(*me, KalecGUID)) + Kalec->setDeathState(JUST_DIED); + KalecGUID = 0; + } + + ShadowBoltTimer = 7000 + rand()%3 * 1000; + AgonyCurseTimer = 20000; + CorruptionStrikeTimer = 13000; + CheckTimer = 1000; + ResetThreat = 1000; + isEnraged = false; + isBanished = false; + + me->CastSpell(me, AURA_DEMONIC_VISUAL, true); + TeleportAllPlayersBack(); } - } - void DoAction(const int32 param) - { - switch (param) + void EnterCombat(Unit* /*who*/) { - case DO_ENRAGE: - isEnraged = true; - me->CastSpell(me, SPELL_ENRAGE, true); - break; - case DO_BANISH: - isBanished = true; - me->CastSpell(me, SPELL_BANISH, true); - break; + if (Creature *Kalec = me->SummonCreature(MOB_KALEC, me->GetPositionX() + 10, me->GetPositionY() + 5, me->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 0)) + { + KalecGUID = Kalec->GetGUID(); + me->CombatStart(Kalec); + me->AddThreat(Kalec, 100.0f); + Kalec->setActive(true); + } + DoScriptText(SAY_SATH_AGGRO, me); } - } - void UpdateAI(const uint32 diff) - { - if (!me->HasAura(AURA_SPECTRAL_INVISIBILITY)) - me->CastSpell(me, AURA_SPECTRAL_INVISIBILITY, true); - if (!UpdateVictim()) - return; + void DamageTaken(Unit *done_by, uint32 &damage) + { + if (damage >= me->GetHealth() && done_by != me) + damage = 0; + } - if (CheckTimer <= diff) + void KilledUnit(Unit *pTarget) { - Creature *Kalec = Unit::GetCreature(*me, KalecGUID); - if (!Kalec || (Kalec && !Kalec->isAlive())) + if (pTarget->GetGUID() == KalecGUID) { + TeleportAllPlayersBack(); if (Creature *Kalecgos = Unit::GetCreature(*me, KalecgosGUID)) - Kalecgos->AI()->EnterEvadeMode(); - return; + { + CAST_AI(boss_kalecgos::boss_kalecgosAI, Kalecgos->AI())->TalkTimer = 1; + CAST_AI(boss_kalecgos::boss_kalecgosAI, Kalecgos->AI())->isFriendly = false; + } + EnterEvadeMode(); + return; } - if (HealthBelowPct(10) && !isEnraged) + DoScriptText(RAND(SAY_SATH_SLAY1,SAY_SATH_SLAY2), me); + } + + void JustDied(Unit * /*killer*/) + { + DoScriptText(SAY_SATH_DEATH, me); + me->GetMap()->CreatureRelocation(me, me->GetPositionX(), me->GetPositionY(), DRAGON_REALM_Z, me->GetOrientation()); + TeleportAllPlayersBack(); + if (Creature *Kalecgos = Unit::GetCreature(*me, KalecgosGUID)) { - if (Creature* Kalecgos = Unit::GetCreature(*me, KalecgosGUID)) - Kalecgos->AI()->DoAction(DO_ENRAGE); - DoAction(DO_ENRAGE); + CAST_AI(boss_kalecgos::boss_kalecgosAI, Kalecgos->AI())->TalkTimer = 1; + CAST_AI(boss_kalecgos::boss_kalecgosAI, Kalecgos->AI())->isFriendly = true; } - Creature *Kalecgos = Unit::GetCreature(*me, KalecgosGUID); - if (Kalecgos) + + if (pInstance) + pInstance->SetData(DATA_KALECGOS_EVENT, DONE); + } + + void TeleportAllPlayersBack() + { + Map* pMap = me->GetMap(); + if (!pMap->IsDungeon()) return; + Map::PlayerList const &PlayerList = pMap->GetPlayers(); + for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) { - if (!Kalecgos->isInCombat()) + if (i->getSource()->GetPositionZ() <= DRAGON_REALM_Z-5) { - me->AI()->EnterEvadeMode(); - return; + i->getSource()->RemoveAura(AURA_SPECTRAL_REALM); + i->getSource()->TeleportTo(me->GetMap()->GetId(),i->getSource()->GetPositionX(),i->getSource()->GetPositionY(),DRAGON_REALM_Z+5,i->getSource()->GetOrientation()); } } - if (!isBanished && HealthBelowPct(1)) + } + + void DoAction(const int32 param) + { + switch (param) { + case DO_ENRAGE: + isEnraged = true; + me->CastSpell(me, SPELL_ENRAGE, true); + break; + case DO_BANISH: + isBanished = true; + me->CastSpell(me, SPELL_BANISH, true); + break; + } + } + + void UpdateAI(const uint32 diff) + { + if (!me->HasAura(AURA_SPECTRAL_INVISIBILITY)) + me->CastSpell(me, AURA_SPECTRAL_INVISIBILITY, true); + if (!UpdateVictim()) + return; + + if (CheckTimer <= diff) + { + Creature *Kalec = Unit::GetCreature(*me, KalecGUID); + if (!Kalec || (Kalec && !Kalec->isAlive())) + { + if (Creature *Kalecgos = Unit::GetCreature(*me, KalecgosGUID)) + Kalecgos->AI()->EnterEvadeMode(); + return; + } + if (HealthBelowPct(10) && !isEnraged) + { + if (Creature* Kalecgos = Unit::GetCreature(*me, KalecgosGUID)) + Kalecgos->AI()->DoAction(DO_ENRAGE); + DoAction(DO_ENRAGE); + } + Creature *Kalecgos = Unit::GetCreature(*me, KalecgosGUID); if (Kalecgos) { - if (Kalecgos->HasAura(SPELL_BANISH)) + if (!Kalecgos->isInCombat()) { - me->DealDamage(me, me->GetHealth()); + me->AI()->EnterEvadeMode(); return; } - else - DoAction(DO_BANISH); } - else + if (!isBanished && HealthBelowPct(1)) { - me->MonsterTextEmote(EMOTE_UNABLE_TO_FIND, NULL); - EnterEvadeMode(); - return; + if (Kalecgos) + { + if (Kalecgos->HasAura(SPELL_BANISH)) + { + me->DealDamage(me, me->GetHealth()); + return; + } + else + DoAction(DO_BANISH); + } + else + { + me->MonsterTextEmote(EMOTE_UNABLE_TO_FIND, NULL); + EnterEvadeMode(); + return; + } } - } - CheckTimer = 1000; - } else CheckTimer -= diff; + CheckTimer = 1000; + } else CheckTimer -= diff; - if (ResetThreat <= diff) - { - for (std::list<HostileReference*>::const_iterator itr = me->getThreatManager().getThreatList().begin(); itr != me->getThreatManager().getThreatList().end(); ++itr) + if (ResetThreat <= diff) { - if (Unit* pUnit = Unit::GetUnit(*me, (*itr)->getUnitGuid())) + for (std::list<HostileReference*>::const_iterator itr = me->getThreatManager().getThreatList().begin(); itr != me->getThreatManager().getThreatList().end(); ++itr) { - if (pUnit->GetPositionZ() > me->GetPositionZ()+5) + if (Unit* pUnit = Unit::GetUnit(*me, (*itr)->getUnitGuid())) { - me->getThreatManager().modifyThreatPercent(pUnit,-100); + if (pUnit->GetPositionZ() > me->GetPositionZ()+5) + { + me->getThreatManager().modifyThreatPercent(pUnit,-100); + } } } - } - ResetThreat = 1000; - } else ResetThreat -= diff; - - if (ShadowBoltTimer <= diff) - { - if (!(rand()%5))DoScriptText(SAY_SATH_SPELL1, me); - DoCast(me, SPELL_SHADOW_BOLT); - ShadowBoltTimer = 7000+(rand()%3000); - } else ShadowBoltTimer -= diff; - - if (AgonyCurseTimer <= diff) - { - Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); - if (!pTarget) pTarget = me->getVictim(); - DoCast(pTarget, SPELL_AGONY_CURSE); - AgonyCurseTimer = 20000; - } else AgonyCurseTimer -= diff; - - if (CorruptionStrikeTimer <= diff) - { - if (!(rand()%5))DoScriptText(SAY_SATH_SPELL2, me); - DoCast(me->getVictim(), SPELL_CORRUPTION_STRIKE); - CorruptionStrikeTimer = 13000; - } else CorruptionStrikeTimer -= diff; - - DoMeleeAttackIfReady(); - } -}; - -struct boss_kalecAI : public ScriptedAI -{ - ScriptedInstance *pInstance; - - uint32 RevitalizeTimer; - uint32 HeroicStrikeTimer; - uint32 YellTimer; - uint32 YellSequence; - - uint64 SathGUID; + ResetThreat = 1000; + } else ResetThreat -= diff; - bool isEnraged; // if demon is enraged - - boss_kalecAI(Creature *c) : ScriptedAI(c) - { - pInstance = c->GetInstanceData(); - } - - void Reset() - { - if (pInstance) - SathGUID = pInstance->GetData64(DATA_SATHROVARR); - - RevitalizeTimer = 5000; - HeroicStrikeTimer = 3000; - YellTimer = 5000; - YellSequence = 0; - - isEnraged = false; - } - - void DamageTaken(Unit *done_by, uint32 &damage) - { - if (done_by->GetGUID() != SathGUID) - damage = 0; - else if (isEnraged) - damage *= 3; - } - - void UpdateAI(const uint32 diff) - { - if (!me->HasAura(AURA_SPECTRAL_INVISIBILITY)) - me->CastSpell(me, AURA_SPECTRAL_INVISIBILITY, true); - if (!UpdateVictim()) - return; + if (ShadowBoltTimer <= diff) + { + if (!(rand()%5))DoScriptText(SAY_SATH_SPELL1, me); + DoCast(me, SPELL_SHADOW_BOLT); + ShadowBoltTimer = 7000+(rand()%3000); + } else ShadowBoltTimer -= diff; - if (YellTimer <= diff) - { - switch(YellSequence) + if (AgonyCurseTimer <= diff) { - case 0: - DoScriptText(SAY_GOOD_AGGRO, me); - ++YellSequence; - break; - case 1: - if (HealthBelowPct(50)) - { - DoScriptText(SAY_GOOD_NEAR_DEATH, me); - ++YellSequence; - } - break; - case 2: - if (HealthBelowPct(10)) - { - DoScriptText(SAY_GOOD_NEAR_DEATH2, me); - ++YellSequence; - } - break; - default: - break; - } - YellTimer = 5000; - } + Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); + if (!pTarget) pTarget = me->getVictim(); + DoCast(pTarget, SPELL_AGONY_CURSE); + AgonyCurseTimer = 20000; + } else AgonyCurseTimer -= diff; - if (RevitalizeTimer <= diff) - { - DoCast(me, SPELL_REVITALIZE); - RevitalizeTimer = 5000; - } else RevitalizeTimer -= diff; + if (CorruptionStrikeTimer <= diff) + { + if (!(rand()%5))DoScriptText(SAY_SATH_SPELL2, me); + DoCast(me->getVictim(), SPELL_CORRUPTION_STRIKE); + CorruptionStrikeTimer = 13000; + } else CorruptionStrikeTimer -= diff; - if (HeroicStrikeTimer <= diff) - { - DoCast(me->getVictim(), SPELL_HEROIC_STRIKE); - HeroicStrikeTimer = 2000; - } else HeroicStrikeTimer -= diff; + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -bool GOkalecgos_teleporter(Player* pPlayer, GameObject* pGo) -{ - uint32 SpectralPlayers = 0; - Map* pMap = pGo->GetMap(); - if (!pMap->IsDungeon()) return true; - Map::PlayerList const &PlayerList = pMap->GetPlayers(); - for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) - { - if (i->getSource() && i->getSource()->GetPositionZ() < DEMON_REALM_Z + 5) - ++SpectralPlayers; - } - if (pPlayer->HasAura(AURA_SPECTRAL_EXHAUSTION) || (MAX_PLAYERS_IN_SPECTRAL_REALM && SpectralPlayers >= MAX_PLAYERS_IN_SPECTRAL_REALM)) - pPlayer->GetSession()->SendNotification(GO_FAILED); - else - pPlayer->CastSpell(pPlayer, SPELL_TELEPORT_SPECTRAL, true); - return true; -} - -CreatureAI* GetAI_boss_kalecgos(Creature* pCreature) -{ - return new boss_kalecgosAI (pCreature); -} - -CreatureAI* GetAI_boss_Sathrovarr(Creature* pCreature) -{ - return new boss_sathrovarrAI (pCreature); -} - -CreatureAI* GetAI_boss_kalec(Creature* pCreature) -{ - return new boss_kalecAI (pCreature); -} void AddSC_boss_kalecgos() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_kalecgos"; - newscript->GetAI = &GetAI_boss_kalecgos; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_sathrovarr"; - newscript->GetAI = &GetAI_boss_Sathrovarr; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_kalec"; - newscript->GetAI = &GetAI_boss_kalec; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "kalecgos_teleporter"; - newscript->pGOHello = &GOkalecgos_teleporter; - newscript->RegisterSelf(); + new boss_kalecgos(); + new boss_sathrovarr(); + new boss_kalec(); + new kalecgos_teleporter(); } diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp index 01b0539c5c2..04d43100bf7 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp @@ -238,1172 +238,1199 @@ static Speech Speeches[]= {SAY_KALECGOS_GOODBYE, DATA_KALECGOS_KJ, 12000}, }; -//AI for Kalecgos -struct boss_kalecgos_kjAI : public ScriptedAI +//AI for Kalecgos
class boss_kalecgos_kj : public CreatureScript { - boss_kalecgos_kjAI(Creature* c) : ScriptedAI(c) - { - pInstance = c->GetInstanceData(); - } +public: + boss_kalecgos_kj() : CreatureScript("boss_kalecgos_kj") { } - ScriptedInstance* pInstance; - uint8 OrbsEmpowered; - uint8 EmpowerCount; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - OrbsEmpowered = 0; - EmpowerCount = 0; - me->AddUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT | MOVEMENTFLAG_LEVITATING); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->setActive(true); - - for (uint8 i = 0; i < 4; ++i) - if (GameObject* pOrb = GetOrb(i)) - pOrb->SetGoType(GAMEOBJECT_TYPE_BUTTON); + return new boss_kalecgos_kjAI (pCreature); } - GameObject* GetOrb(int32 index) + struct boss_kalecgos_kjAI : public ScriptedAI { - if (!pInstance) - return NULL; + boss_kalecgos_kjAI(Creature* c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } - switch(index) + InstanceScript* pInstance; + uint8 OrbsEmpowered; + uint8 EmpowerCount; + + void Reset() { - case 0: - return pInstance->instance->GetGameObject(pInstance->GetData64(DATA_ORB_OF_THE_BLUE_DRAGONFLIGHT_1)); - case 1: - return pInstance->instance->GetGameObject(pInstance->GetData64(DATA_ORB_OF_THE_BLUE_DRAGONFLIGHT_2)); - case 2: - return pInstance->instance->GetGameObject(pInstance->GetData64(DATA_ORB_OF_THE_BLUE_DRAGONFLIGHT_3)); - case 3: - return pInstance->instance->GetGameObject(pInstance->GetData64(DATA_ORB_OF_THE_BLUE_DRAGONFLIGHT_4)); + OrbsEmpowered = 0; + EmpowerCount = 0; + me->AddUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT | MOVEMENTFLAG_LEVITATING); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->setActive(true); + + for (uint8 i = 0; i < 4; ++i) + if (GameObject* pOrb = GetOrb(i)) + pOrb->SetGoType(GAMEOBJECT_TYPE_BUTTON); } - return NULL; - } + GameObject* GetOrb(int32 index) + { + if (!pInstance) + return NULL; - void ResetOrbs() - { - me->RemoveDynObject(SPELL_RING_OF_BLUE_FLAMES); - for (uint8 i = 0; i < 4; ++i) - if (GameObject* pOrb = GetOrb(i)) - pOrb->SetUInt32Value(GAMEOBJECT_FACTION, 0); - } + switch(index) + { + case 0: + return pInstance->instance->GetGameObject(pInstance->GetData64(DATA_ORB_OF_THE_BLUE_DRAGONFLIGHT_1)); + case 1: + return pInstance->instance->GetGameObject(pInstance->GetData64(DATA_ORB_OF_THE_BLUE_DRAGONFLIGHT_2)); + case 2: + return pInstance->instance->GetGameObject(pInstance->GetData64(DATA_ORB_OF_THE_BLUE_DRAGONFLIGHT_3)); + case 3: + return pInstance->instance->GetGameObject(pInstance->GetData64(DATA_ORB_OF_THE_BLUE_DRAGONFLIGHT_4)); + } - void EmpowerOrb(bool all) - { - GameObject* pOrbEmpowered = GetOrb(OrbsEmpowered); - if (!pOrbEmpowered) - return; + return NULL; + } - if (all) + void ResetOrbs() { me->RemoveDynObject(SPELL_RING_OF_BLUE_FLAMES); for (uint8 i = 0; i < 4; ++i) + if (GameObject* pOrb = GetOrb(i)) + pOrb->SetUInt32Value(GAMEOBJECT_FACTION, 0); + } + + void EmpowerOrb(bool all) + { + GameObject* pOrbEmpowered = GetOrb(OrbsEmpowered); + if (!pOrbEmpowered) + return; + + if (all) { - if (GameObject* pOrb = GetOrb(i)) + me->RemoveDynObject(SPELL_RING_OF_BLUE_FLAMES); + for (uint8 i = 0; i < 4; ++i) + { + if (GameObject* pOrb = GetOrb(i)) + { + pOrb->CastSpell(me, SPELL_RING_OF_BLUE_FLAMES); + pOrb->SetUInt32Value(GAMEOBJECT_FACTION, 35); + pOrb->setActive(true); + pOrb->Refresh(); + } + } + DoScriptText(SAY_KALECGOS_ENCOURAGE, me); + } + else + { + if (GameObject* pOrb = GetOrb(urand(0,3))) { pOrb->CastSpell(me, SPELL_RING_OF_BLUE_FLAMES); pOrb->SetUInt32Value(GAMEOBJECT_FACTION, 35); pOrb->setActive(true); pOrb->Refresh(); - } - } - DoScriptText(SAY_KALECGOS_ENCOURAGE, me); - } - else - { - if (GameObject* pOrb = GetOrb(urand(0,3))) - { - pOrb->CastSpell(me, SPELL_RING_OF_BLUE_FLAMES); - pOrb->SetUInt32Value(GAMEOBJECT_FACTION, 35); - pOrb->setActive(true); - pOrb->Refresh(); - OrbsEmpowered = (OrbsEmpowered+1)%4; + OrbsEmpowered = (OrbsEmpowered+1)%4; - ++EmpowerCount; - switch(EmpowerCount) - { - case 1: DoScriptText(SAY_KALEC_ORB_READY1, me); break; - case 2: DoScriptText(SAY_KALEC_ORB_READY2, me); break; - case 3: DoScriptText(SAY_KALEC_ORB_READY3, me); break; - case 4: DoScriptText(SAY_KALEC_ORB_READY4, me); break; + ++EmpowerCount; + switch(EmpowerCount) + { + case 1: DoScriptText(SAY_KALEC_ORB_READY1, me); break; + case 2: DoScriptText(SAY_KALEC_ORB_READY2, me); break; + case 3: DoScriptText(SAY_KALEC_ORB_READY3, me); break; + case 4: DoScriptText(SAY_KALEC_ORB_READY4, me); break; + } } } } - } - void UpdateAI(const uint32 diff) - { - } + void UpdateAI(const uint32 diff) + { + } - void SetRingOfBlueFlames() - { - me->RemoveDynObject(SPELL_RING_OF_BLUE_FLAMES); - for (uint8 i = 0; i < 4; ++i) + void SetRingOfBlueFlames() { - if (GameObject* pOrb = GetOrb(i)) + me->RemoveDynObject(SPELL_RING_OF_BLUE_FLAMES); + for (uint8 i = 0; i < 4; ++i) { - if (pOrb->GetUInt32Value(GAMEOBJECT_FACTION) == 35) + if (GameObject* pOrb = GetOrb(i)) { - pOrb->CastSpell(me, SPELL_RING_OF_BLUE_FLAMES); - pOrb->setActive(true); - pOrb->Refresh(); + if (pOrb->GetUInt32Value(GAMEOBJECT_FACTION) == 35) + { + pOrb->CastSpell(me, SPELL_RING_OF_BLUE_FLAMES); + pOrb->setActive(true); + pOrb->Refresh(); + } } } } - } -}; + }; -CreatureAI* GetAI_boss_kalecgos_kj(Creature* pCreature) +}; +
class go_orb_of_the_blue_flight : public GameObjectScript { - return new boss_kalecgos_kjAI (pCreature); -} +public: + go_orb_of_the_blue_flight() : GameObjectScript("go_orb_of_the_blue_flight") { } -bool GOHello_go_orb_of_the_blue_flight(Player* pPlayer, GameObject* pGo) -{ - if (pGo->GetUInt32Value(GAMEOBJECT_FACTION) == 35) + bool OnGossipHello(Player* pPlayer, GameObject* pGo) { - ScriptedInstance* pInstance = pGo->GetInstanceData(); - pPlayer->SummonCreature(CREATURE_POWER_OF_THE_BLUE_DRAGONFLIGHT, pPlayer->GetPositionX(), pPlayer->GetPositionY(), pPlayer->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN, 121000); - pPlayer->CastSpell(pPlayer, SPELL_VENGEANCE_OF_THE_BLUE_FLIGHT, false); - pGo->SetUInt32Value(GAMEOBJECT_FACTION, 0); + if (pGo->GetUInt32Value(GAMEOBJECT_FACTION) == 35) + { + InstanceScript* pInstance = pGo->GetInstanceScript(); + pPlayer->SummonCreature(CREATURE_POWER_OF_THE_BLUE_DRAGONFLIGHT, pPlayer->GetPositionX(), pPlayer->GetPositionY(), pPlayer->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN, 121000); + pPlayer->CastSpell(pPlayer, SPELL_VENGEANCE_OF_THE_BLUE_FLIGHT, false); + pGo->SetUInt32Value(GAMEOBJECT_FACTION, 0); - if (Creature* pKalec = Unit::GetCreature(*pPlayer, pInstance->GetData64(DATA_KALECGOS_KJ))) - CAST_AI(boss_kalecgos_kjAI, pKalec->AI())->SetRingOfBlueFlames(); + if (Creature* pKalec = Unit::GetCreature(*pPlayer, pInstance->GetData64(DATA_KALECGOS_KJ))) + CAST_AI(boss_kalecgos_kj::boss_kalecgos_kjAI, pKalec->AI())->SetRingOfBlueFlames(); - pGo->Refresh(); + pGo->Refresh(); + } + return true; } - return true; -} -//AI for Kil'jaeden Event Controller -struct mob_kiljaeden_controllerAI : public Scripted_NoMovementAI +}; + +//AI for Kil'jaeden Event Controller
class mob_kiljaeden_controller : public CreatureScript { - mob_kiljaeden_controllerAI(Creature* c) : Scripted_NoMovementAI(c), summons(me) +public: + mob_kiljaeden_controller() : CreatureScript("mob_kiljaeden_controller") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new mob_kiljaeden_controllerAI (pCreature); } - ScriptedInstance* pInstance; - SummonList summons; - - bool bSummonedDeceivers; - bool bKiljaedenDeath; - - uint32 uiRandomSayTimer; - uint32 phase; - uint8 deceiverDeathCount; - - void InitializeAI() + struct mob_kiljaeden_controllerAI : public Scripted_NoMovementAI { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->addUnitState(UNIT_STAT_STUNNED); + mob_kiljaeden_controllerAI(Creature* c) : Scripted_NoMovementAI(c), summons(me) + { + pInstance = c->GetInstanceScript(); + } - ScriptedAI::InitializeAI(); - } + InstanceScript* pInstance; + SummonList summons; - void Reset() - { - phase = PHASE_DECEIVERS; - - if (Creature* pKalecKJ = Unit::GetCreature((*me), pInstance->GetData64(DATA_KALECGOS_KJ))) - CAST_AI(boss_kalecgos_kjAI, pKalecKJ->AI())->ResetOrbs(); - deceiverDeathCount = 0; - bSummonedDeceivers = false; - bKiljaedenDeath = false; - uiRandomSayTimer = 30000; - summons.DespawnAll(); - } + bool bSummonedDeceivers; + bool bKiljaedenDeath; - void JustSummoned(Creature* summoned) - { - switch(summoned->GetEntry()) + uint32 uiRandomSayTimer; + uint32 phase; + uint8 deceiverDeathCount; + + void InitializeAI() { - case CREATURE_HAND_OF_THE_DECEIVER: - summoned->CastSpell(summoned, SPELL_SHADOW_CHANNELING, false); - break; - case CREATURE_ANVEENA: - summoned->AddUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT | MOVEMENTFLAG_LEVITATING); - summoned->CastSpell(summoned, SPELL_ANVEENA_PRISON, true); - summoned->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - break; - case CREATURE_KILJAEDEN: - summoned->CastSpell(summoned, SPELL_REBIRTH, false); - summoned->AddThreat(me->getVictim(), 1.0f); - break; + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->addUnitState(UNIT_STAT_STUNNED); + + ScriptedAI::InitializeAI(); } - summons.Summon(summoned); - } - void UpdateAI(const uint32 diff) - { - if (uiRandomSayTimer < diff) + void Reset() { - if (pInstance && pInstance->GetData(DATA_MURU_EVENT) != DONE && pInstance->GetData(DATA_KILJAEDEN_EVENT) == NOT_STARTED) - DoScriptText(RAND(SAY_KJ_OFFCOMBAT1,SAY_KJ_OFFCOMBAT2,SAY_KJ_OFFCOMBAT3,SAY_KJ_OFFCOMBAT4,SAY_KJ_OFFCOMBAT5), me); + phase = PHASE_DECEIVERS; + + if (Creature* pKalecKJ = Unit::GetCreature((*me), pInstance->GetData64(DATA_KALECGOS_KJ))) + CAST_AI(boss_kalecgos_kj::boss_kalecgos_kjAI, pKalecKJ->AI())->ResetOrbs(); + deceiverDeathCount = 0; + bSummonedDeceivers = false; + bKiljaedenDeath = false; uiRandomSayTimer = 30000; - } else uiRandomSayTimer -= diff; + summons.DespawnAll(); + } - if (!bSummonedDeceivers) + void JustSummoned(Creature* summoned) { - for (uint8 i = 0; i < 3; ++i) - me->SummonCreature(CREATURE_HAND_OF_THE_DECEIVER, DeceiverLocations[i], TEMPSUMMON_DEAD_DESPAWN, 0); - - DoSpawnCreature(CREATURE_ANVEENA, 0, 0, 40, 0, TEMPSUMMON_DEAD_DESPAWN, 0); - DoCast(me, SPELL_ANVEENA_ENERGY_DRAIN); - bSummonedDeceivers = true; + switch(summoned->GetEntry()) + { + case CREATURE_HAND_OF_THE_DECEIVER: + summoned->CastSpell(summoned, SPELL_SHADOW_CHANNELING, false); + break; + case CREATURE_ANVEENA: + summoned->AddUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT | MOVEMENTFLAG_LEVITATING); + summoned->CastSpell(summoned, SPELL_ANVEENA_PRISON, true); + summoned->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + break; + case CREATURE_KILJAEDEN: + summoned->CastSpell(summoned, SPELL_REBIRTH, false); + summoned->AddThreat(me->getVictim(), 1.0f); + break; + } + summons.Summon(summoned); } - if (deceiverDeathCount > 2 && phase == PHASE_DECEIVERS) + void UpdateAI(const uint32 diff) { - me->RemoveAurasDueToSpell(SPELL_ANVEENA_ENERGY_DRAIN); - phase = PHASE_NORMAL; - DoSpawnCreature(CREATURE_KILJAEDEN, 0, 0,0, 0, TEMPSUMMON_MANUAL_DESPAWN, 0); + if (uiRandomSayTimer < diff) + { + if (pInstance && pInstance->GetData(DATA_MURU_EVENT) != DONE && pInstance->GetData(DATA_KILJAEDEN_EVENT) == NOT_STARTED) + DoScriptText(RAND(SAY_KJ_OFFCOMBAT1,SAY_KJ_OFFCOMBAT2,SAY_KJ_OFFCOMBAT3,SAY_KJ_OFFCOMBAT4,SAY_KJ_OFFCOMBAT5), me); + uiRandomSayTimer = 30000; + } else uiRandomSayTimer -= diff; + + if (!bSummonedDeceivers) + { + for (uint8 i = 0; i < 3; ++i) + me->SummonCreature(CREATURE_HAND_OF_THE_DECEIVER, DeceiverLocations[i], TEMPSUMMON_DEAD_DESPAWN, 0); + + DoSpawnCreature(CREATURE_ANVEENA, 0, 0, 40, 0, TEMPSUMMON_DEAD_DESPAWN, 0); + DoCast(me, SPELL_ANVEENA_ENERGY_DRAIN); + bSummonedDeceivers = true; + } + + if (deceiverDeathCount > 2 && phase == PHASE_DECEIVERS) + { + me->RemoveAurasDueToSpell(SPELL_ANVEENA_ENERGY_DRAIN); + phase = PHASE_NORMAL; + DoSpawnCreature(CREATURE_KILJAEDEN, 0, 0,0, 0, TEMPSUMMON_MANUAL_DESPAWN, 0); + } } - } + }; + }; -CreatureAI* GetAI_mob_kiljaeden_controller(Creature* pCreature) -{ - return new mob_kiljaeden_controllerAI (pCreature); -} -//AI for Kil'jaeden -struct boss_kiljaedenAI : public Scripted_NoMovementAI +//AI for Kil'jaeden
class boss_kiljaeden : public CreatureScript { - boss_kiljaedenAI(Creature* c) : Scripted_NoMovementAI(c), summons(me) +public: + boss_kiljaeden() : CreatureScript("boss_kiljaeden") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_kiljaedenAI (pCreature); } - ScriptedInstance* pInstance; - SummonList summons; + struct boss_kiljaedenAI : public Scripted_NoMovementAI + { + boss_kiljaedenAI(Creature* c) : Scripted_NoMovementAI(c), summons(me) + { + pInstance = c->GetInstanceScript(); + } - uint8 Phase; - uint8 ActiveTimers; - uint32 SpeechTimer; + InstanceScript* pInstance; + SummonList summons; - uint32 Timer[10]; - uint32 WaitTimer; - uint8 speechCount; - uint8 speechPhaseEnd; + uint8 Phase; + uint8 ActiveTimers; + uint32 SpeechTimer; - /* Boolean */ - bool IsInDarkness; - bool TimerIsDeactivated[10]; - bool IsWaiting; - bool OrbActivated; - bool SpeechBegins; + uint32 Timer[10]; + uint32 WaitTimer; + uint8 speechCount; + uint8 speechPhaseEnd; - void InitializeAI() - { - Scripted_NoMovementAI::InitializeAI(); - } + /* Boolean */ + bool IsInDarkness; + bool TimerIsDeactivated[10]; + bool IsWaiting; + bool OrbActivated; + bool SpeechBegins; - void Reset() - { - TimerIsDeactivated[TIMER_SPEECH] = false; - Timer[TIMER_SPEECH] = 0; + void InitializeAI() + { + Scripted_NoMovementAI::InitializeAI(); + } - //Phase 2 Timer - Timer[TIMER_SOUL_FLAY] = 11000; - Timer[TIMER_LEGION_LIGHTNING] = 30000; - Timer[TIMER_FIRE_BLOOM] = 20000; - Timer[TIMER_SUMMON_SHILEDORB] = 35000; + void Reset() + { + TimerIsDeactivated[TIMER_SPEECH] = false; + Timer[TIMER_SPEECH] = 0; - //Phase 3 Timer - Timer[TIMER_SHADOW_SPIKE] = 4000; - Timer[TIMER_FLAME_DART] = 3000; - Timer[TIMER_DARKNESS] = 45000; - Timer[TIMER_ORBS_EMPOWER] = 35000; + //Phase 2 Timer + Timer[TIMER_SOUL_FLAY] = 11000; + Timer[TIMER_LEGION_LIGHTNING] = 30000; + Timer[TIMER_FIRE_BLOOM] = 20000; + Timer[TIMER_SUMMON_SHILEDORB] = 35000; - //Phase 4 Timer - Timer[TIMER_ARMAGEDDON] = 2000; + //Phase 3 Timer + Timer[TIMER_SHADOW_SPIKE] = 4000; + Timer[TIMER_FLAME_DART] = 3000; + Timer[TIMER_DARKNESS] = 45000; + Timer[TIMER_ORBS_EMPOWER] = 35000; - ActiveTimers = 5; - WaitTimer = 0; - speechCount = 0; - SpeechTimer = 0; + //Phase 4 Timer + Timer[TIMER_ARMAGEDDON] = 2000; - Phase = PHASE_NORMAL; + ActiveTimers = 5; + WaitTimer = 0; + speechCount = 0; + SpeechTimer = 0; - IsInDarkness = false; - IsWaiting = false; - OrbActivated = false; - SpeechBegins = true; + Phase = PHASE_NORMAL; - if (pInstance) - { - if (Creature* pKalec = Unit::GetCreature(*me, pInstance->GetData64(DATA_KALECGOS_KJ))) - pKalec->RemoveDynObject(SPELL_RING_OF_BLUE_FLAMES); - } - me->SetFloatValue(UNIT_FIELD_COMBATREACH, 12); - ChangeTimers(false, 0); - summons.DespawnAll(); - } + IsInDarkness = false; + IsWaiting = false; + OrbActivated = false; + SpeechBegins = true; - void ChangeTimers(bool status, uint32 WTimer) - { - for (uint8 i = 1; i < ActiveTimers; ++i) - TimerIsDeactivated[i] = status; + if (pInstance) + { + if (Creature* pKalec = Unit::GetCreature(*me, pInstance->GetData64(DATA_KALECGOS_KJ))) + pKalec->RemoveDynObject(SPELL_RING_OF_BLUE_FLAMES); + } + me->SetFloatValue(UNIT_FIELD_COMBATREACH, 12); + ChangeTimers(false, 0); + summons.DespawnAll(); + } - if (WTimer > 0) + void ChangeTimers(bool status, uint32 WTimer) { - IsWaiting = true; - WaitTimer = WTimer; - } + for (uint8 i = 1; i < ActiveTimers; ++i) + TimerIsDeactivated[i] = status; - if (OrbActivated) - TimerIsDeactivated[TIMER_ORBS_EMPOWER] = true; - if (Timer[TIMER_SHADOW_SPIKE] == 0) - TimerIsDeactivated[TIMER_SHADOW_SPIKE] = true; - if (Phase == PHASE_SACRIFICE) - TimerIsDeactivated[TIMER_SUMMON_SHILEDORB] = true; - } + if (WTimer > 0) + { + IsWaiting = true; + WaitTimer = WTimer; + } - void JustSummoned(Creature* summoned) - { - if (summoned->GetEntry() == CREATURE_ARMAGEDDON_TARGET) - { - summoned->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - summoned->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - // summoned->SetVisibility(VISIBILITY_OFF); //with this we cant see the armageddon visuals + if (OrbActivated) + TimerIsDeactivated[TIMER_ORBS_EMPOWER] = true; + if (Timer[TIMER_SHADOW_SPIKE] == 0) + TimerIsDeactivated[TIMER_SHADOW_SPIKE] = true; + if (Phase == PHASE_SACRIFICE) + TimerIsDeactivated[TIMER_SUMMON_SHILEDORB] = true; } - else - summoned->SetLevel(me->getLevel()); - summoned->setFaction(me->getFaction()); - summons.Summon(summoned); - } + void JustSummoned(Creature* summoned) + { + if (summoned->GetEntry() == CREATURE_ARMAGEDDON_TARGET) + { + summoned->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + summoned->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + // summoned->SetVisibility(VISIBILITY_OFF); //with this we cant see the armageddon visuals + } + else + summoned->SetLevel(me->getLevel()); - void JustDied(Unit* killer) - { - DoScriptText(SAY_KJ_DEATH, me); - summons.DespawnAll(); + summoned->setFaction(me->getFaction()); + summons.Summon(summoned); + } - if (pInstance) - pInstance->SetData(DATA_KILJAEDEN_EVENT, DONE); - } + void JustDied(Unit* killer) + { + DoScriptText(SAY_KJ_DEATH, me); + summons.DespawnAll(); - void KilledUnit(Unit* victim) - { - DoScriptText(RAND(SAY_KJ_SLAY1,SAY_KJ_SLAY2), me); - } + if (pInstance) + pInstance->SetData(DATA_KILJAEDEN_EVENT, DONE); + } - void EnterEvadeMode() - { - Scripted_NoMovementAI::EnterEvadeMode(); - summons.DespawnAll(); + void KilledUnit(Unit* victim) + { + DoScriptText(RAND(SAY_KJ_SLAY1,SAY_KJ_SLAY2), me); + } - // Reset the controller - if (pInstance) + void EnterEvadeMode() { - if (Creature* pControl = Unit::GetCreature(*me, pInstance->GetData64(DATA_KILJAEDEN_CONTROLLER))) - CAST_AI(mob_kiljaeden_controllerAI, pControl->AI())->Reset(); + Scripted_NoMovementAI::EnterEvadeMode(); + summons.DespawnAll(); + + // Reset the controller + if (pInstance) + { + if (Creature* pControl = Unit::GetCreature(*me, pInstance->GetData64(DATA_KILJAEDEN_CONTROLLER))) + CAST_AI(mob_kiljaeden_controller::mob_kiljaeden_controllerAI, pControl->AI())->Reset(); + } } - } - void EnterCombat(Unit* who) - { - DoZoneInCombat(); - } + void EnterCombat(Unit* who) + { + DoZoneInCombat(); + } - void EnterNextPhase() - { - SpeechBegins = true; - OrbActivated = false; - ChangeTimers(true, 0);//stop every cast Shadow spike will reactivate em all - TimerIsDeactivated[TIMER_SHADOW_SPIKE] = false; - Timer[TIMER_SHADOW_SPIKE] = 100; - // empowered orbs before darkness - Timer[TIMER_DARKNESS] = (Phase == PHASE_SACRIFICE) ? 15000 : urand(10000,40000); - Timer[TIMER_ORBS_EMPOWER] = (Phase == PHASE_SACRIFICE) ? 10000 : 5000; - } + void EnterNextPhase() + { + SpeechBegins = true; + OrbActivated = false; + ChangeTimers(true, 0);//stop every cast Shadow spike will reactivate em all + TimerIsDeactivated[TIMER_SHADOW_SPIKE] = false; + Timer[TIMER_SHADOW_SPIKE] = 100; + // empowered orbs before darkness + Timer[TIMER_DARKNESS] = (Phase == PHASE_SACRIFICE) ? 15000 : urand(10000,40000); + Timer[TIMER_ORBS_EMPOWER] = (Phase == PHASE_SACRIFICE) ? 10000 : 5000; + } - void CastSinisterReflection() - { - DoScriptText(RAND(SAY_KJ_REFLECTION1,SAY_KJ_REFLECTION2), me); - for (uint8 i = 0; i < 4; ++i) + void CastSinisterReflection() { - float x,y,z; - Unit *pTarget; - for (uint8 z = 0; z < 6; ++z) - { - pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); - if (!pTarget || !pTarget->HasAura(SPELL_VENGEANCE_OF_THE_BLUE_FLIGHT,0))break; - } - if (pTarget) + DoScriptText(RAND(SAY_KJ_REFLECTION1,SAY_KJ_REFLECTION2), me); + for (uint8 i = 0; i < 4; ++i) { - pTarget->GetPosition(x,y,z); - if (Creature* pSinisterReflection = me->SummonCreature(CREATURE_SINISTER_REFLECTION, x,y,z,0, TEMPSUMMON_CORPSE_DESPAWN, 0)) + float x,y,z; + Unit *pTarget; + for (uint8 z = 0; z < 6; ++z) { - pSinisterReflection->SetDisplayId(pTarget->GetDisplayId()); - pSinisterReflection->AI()->AttackStart(pTarget); + pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); + if (!pTarget || !pTarget->HasAura(SPELL_VENGEANCE_OF_THE_BLUE_FLIGHT,0))break; + } + if (pTarget) + { + pTarget->GetPosition(x,y,z); + if (Creature* pSinisterReflection = me->SummonCreature(CREATURE_SINISTER_REFLECTION, x,y,z,0, TEMPSUMMON_CORPSE_DESPAWN, 0)) + { + pSinisterReflection->SetDisplayId(pTarget->GetDisplayId()); + pSinisterReflection->AI()->AttackStart(pTarget); + } } } } - } - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim() || Phase < PHASE_NORMAL) - return; - - if (IsWaiting) + void UpdateAI(const uint32 diff) { - if (WaitTimer <= diff) + if (!UpdateVictim() || Phase < PHASE_NORMAL) + return; + + if (IsWaiting) { - IsWaiting = false; - ChangeTimers(false, 0); - } else WaitTimer -= diff; - } + if (WaitTimer <= diff) + { + IsWaiting = false; + ChangeTimers(false, 0); + } else WaitTimer -= diff; + } - for (uint8 t = 0; t < ActiveTimers; ++t) - { - if (Timer[t] < diff && !TimerIsDeactivated[t]) + for (uint8 t = 0; t < ActiveTimers; ++t) { - switch(t) + if (Timer[t] < diff && !TimerIsDeactivated[t]) { - case TIMER_SPEECH: - if (SpeechBegins) - { - SpeechBegins=false; - switch(Phase) + switch(t) + { + case TIMER_SPEECH: + if (SpeechBegins) { - case PHASE_NORMAL: - speechPhaseEnd=1; - break; - case PHASE_DARKNESS: - speechPhaseEnd=4; - break; - case PHASE_ARMAGEDDON: - speechPhaseEnd=7; - break; - case PHASE_SACRIFICE: - speechPhaseEnd=12; - break; + SpeechBegins=false; + switch(Phase) + { + case PHASE_NORMAL: + speechPhaseEnd=1; + break; + case PHASE_DARKNESS: + speechPhaseEnd=4; + break; + case PHASE_ARMAGEDDON: + speechPhaseEnd=7; + break; + case PHASE_SACRIFICE: + speechPhaseEnd=12; + break; + } } - } - if (Speeches[speechCount].timer < SpeechTimer) - { - SpeechTimer = 0; - if (Creature* pSpeechCreature = Unit::GetCreature(*me, pInstance->GetData64(Speeches[speechCount].pCreature))) - DoScriptText(Speeches[speechCount].textid, pSpeechCreature); - if (speechCount == 12) - if (Creature* pAnveena = Unit::GetCreature(*me, pInstance->GetData64(DATA_ANVEENA))) - pAnveena->CastSpell(me, SPELL_SACRIFICE_OF_ANVEENA, false); - // ChangeTimers(true, 10000); // Kil should do an emote while screaming without attacking for 10 seconds - if (speechCount == speechPhaseEnd) - TimerIsDeactivated[TIMER_SPEECH]=true; - speechCount++; - } - SpeechTimer += diff; - break; - case TIMER_SOUL_FLAY: - if (!me->IsNonMeleeSpellCasted(false)) - { - DoCast(me->getVictim(), SPELL_SOUL_FLAY_SLOW, false); - DoCast(me->getVictim(), SPELL_SOUL_FLAY, false); - Timer[TIMER_SOUL_FLAY] = 3500; - } - break; - case TIMER_LEGION_LIGHTNING: - if (!me->IsNonMeleeSpellCasted(false)) - { - Unit* pRandomPlayer; - - me->RemoveAurasDueToSpell(SPELL_SOUL_FLAY); - for (uint8 z = 0; z < 6; ++z) + if (Speeches[speechCount].timer < SpeechTimer) { - pRandomPlayer = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); - if (!pRandomPlayer || !pRandomPlayer->HasAura(SPELL_VENGEANCE_OF_THE_BLUE_FLIGHT,0)) - break; + SpeechTimer = 0; + if (Creature* pSpeechCreature = Unit::GetCreature(*me, pInstance->GetData64(Speeches[speechCount].pCreature))) + DoScriptText(Speeches[speechCount].textid, pSpeechCreature); + if (speechCount == 12) + if (Creature* pAnveena = Unit::GetCreature(*me, pInstance->GetData64(DATA_ANVEENA))) + pAnveena->CastSpell(me, SPELL_SACRIFICE_OF_ANVEENA, false); + // ChangeTimers(true, 10000); // Kil should do an emote while screaming without attacking for 10 seconds + if (speechCount == speechPhaseEnd) + TimerIsDeactivated[TIMER_SPEECH]=true; + speechCount++; } - - if (pRandomPlayer) - DoCast(pRandomPlayer, SPELL_LEGION_LIGHTNING, false); - else - sLog.outError("try to cast SPELL_LEGION_LIGHTNING on invalid target"); + SpeechTimer += diff; + break; + case TIMER_SOUL_FLAY: + if (!me->IsNonMeleeSpellCasted(false)) + { + DoCast(me->getVictim(), SPELL_SOUL_FLAY_SLOW, false); + DoCast(me->getVictim(), SPELL_SOUL_FLAY, false); + Timer[TIMER_SOUL_FLAY] = 3500; + } + break; + case TIMER_LEGION_LIGHTNING: + if (!me->IsNonMeleeSpellCasted(false)) + { + Unit* pRandomPlayer; + + me->RemoveAurasDueToSpell(SPELL_SOUL_FLAY); + for (uint8 z = 0; z < 6; ++z) + { + pRandomPlayer = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); + if (!pRandomPlayer || !pRandomPlayer->HasAura(SPELL_VENGEANCE_OF_THE_BLUE_FLIGHT,0)) + break; + } + + if (pRandomPlayer) + DoCast(pRandomPlayer, SPELL_LEGION_LIGHTNING, false); + else + sLog.outError("try to cast SPELL_LEGION_LIGHTNING on invalid target"); - Timer[TIMER_LEGION_LIGHTNING] = (Phase == PHASE_SACRIFICE) ? 18000 : 30000; // 18 seconds in PHASE_SACRIFICE - Timer[TIMER_SOUL_FLAY] = 2500; - } - break; - case TIMER_FIRE_BLOOM: - if (!me->IsNonMeleeSpellCasted(false)) - { - me->RemoveAurasDueToSpell(SPELL_SOUL_FLAY); - DoCastAOE(SPELL_FIRE_BLOOM, false); - Timer[TIMER_FIRE_BLOOM] = (Phase == PHASE_SACRIFICE) ? 25000 : 40000; // 25 seconds in PHASE_SACRIFICE - Timer[TIMER_SOUL_FLAY] = 1000; - } - break; - case TIMER_SUMMON_SHILEDORB: - for (uint8 i = 1; i < Phase; ++i) - { - float sx, sy; - sx = ShieldOrbLocations[0][0] + sin(ShieldOrbLocations[i][0]); - sy = ShieldOrbLocations[0][1] + sin(ShieldOrbLocations[i][1]); - me->SummonCreature(CREATURE_SHIELD_ORB, sx, sy, SHIELD_ORB_Z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 45000); - } - Timer[TIMER_SUMMON_SHILEDORB] = urand(30000,60000); // 30-60seconds cooldown - Timer[TIMER_SOUL_FLAY] = 2000; - break; - case TIMER_SHADOW_SPIKE: //Phase 3 - if (!me->IsNonMeleeSpellCasted(false)) - { - CastSinisterReflection(); - DoCastAOE(SPELL_SHADOW_SPIKE, false); - ChangeTimers(true, 30000); - Timer[TIMER_SHADOW_SPIKE] = 0; - TimerIsDeactivated[TIMER_SPEECH] = false; - } - break; - case TIMER_FLAME_DART: //Phase 3 - DoCastAOE(SPELL_FLAME_DART, false); - Timer[TIMER_FLAME_DART] = 3000; //TODO Timer - break; - case TIMER_DARKNESS: //Phase 3 - if (!me->IsNonMeleeSpellCasted(false)) - { - // Begins to channel for 8 seconds, then deals 50'000 damage to all raid members. - if (!IsInDarkness) + Timer[TIMER_LEGION_LIGHTNING] = (Phase == PHASE_SACRIFICE) ? 18000 : 30000; // 18 seconds in PHASE_SACRIFICE + Timer[TIMER_SOUL_FLAY] = 2500; + } + break; + case TIMER_FIRE_BLOOM: + if (!me->IsNonMeleeSpellCasted(false)) { - DoScriptText(EMOTE_KJ_DARKNESS, me); - DoCastAOE(SPELL_DARKNESS_OF_A_THOUSAND_SOULS, false); - ChangeTimers(true, 9000); - Timer[TIMER_DARKNESS] = 8750; - TimerIsDeactivated[TIMER_DARKNESS] = false; - if (Phase == PHASE_SACRIFICE) - TimerIsDeactivated[TIMER_ARMAGEDDON] = false; - IsInDarkness = true; + me->RemoveAurasDueToSpell(SPELL_SOUL_FLAY); + DoCastAOE(SPELL_FIRE_BLOOM, false); + Timer[TIMER_FIRE_BLOOM] = (Phase == PHASE_SACRIFICE) ? 25000 : 40000; // 25 seconds in PHASE_SACRIFICE + Timer[TIMER_SOUL_FLAY] = 1000; } - else + break; + case TIMER_SUMMON_SHILEDORB: + for (uint8 i = 1; i < Phase; ++i) { - Timer[TIMER_DARKNESS] = (Phase == PHASE_SACRIFICE) ? 15000 : urand(40000,70000); - IsInDarkness = false; - DoCastAOE(SPELL_DARKNESS_OF_A_THOUSAND_SOULS_DAMAGE); - DoScriptText(RAND(SAY_KJ_DARKNESS1,SAY_KJ_DARKNESS2,SAY_KJ_DARKNESS3), me); + float sx, sy; + sx = ShieldOrbLocations[0][0] + sin(ShieldOrbLocations[i][0]); + sy = ShieldOrbLocations[0][1] + sin(ShieldOrbLocations[i][1]); + me->SummonCreature(CREATURE_SHIELD_ORB, sx, sy, SHIELD_ORB_Z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 45000); } - Timer[TIMER_SOUL_FLAY] = 9000; - } - break; - case TIMER_ORBS_EMPOWER: //Phase 3 - if (Creature* pKalec = Unit::GetCreature(*me, pInstance->GetData64(DATA_KALECGOS_KJ))) - { - switch (Phase) + Timer[TIMER_SUMMON_SHILEDORB] = urand(30000,60000); // 30-60seconds cooldown + Timer[TIMER_SOUL_FLAY] = 2000; + break; + case TIMER_SHADOW_SPIKE: //Phase 3 + if (!me->IsNonMeleeSpellCasted(false)) { - case PHASE_SACRIFICE: - CAST_AI(boss_kalecgos_kjAI, pKalec->AI())->EmpowerOrb(true); - break; - default: - CAST_AI(boss_kalecgos_kjAI, pKalec->AI())->EmpowerOrb(false); - break; + CastSinisterReflection(); + DoCastAOE(SPELL_SHADOW_SPIKE, false); + ChangeTimers(true, 30000); + Timer[TIMER_SHADOW_SPIKE] = 0; + TimerIsDeactivated[TIMER_SPEECH] = false; } - } - OrbActivated = true; - TimerIsDeactivated[TIMER_ORBS_EMPOWER] = true; - break; - case TIMER_ARMAGEDDON: //Phase 4 - Unit *pTarget; - for (uint8 z = 0; z < 6; ++z) - { - pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); - if (!pTarget || !pTarget->HasAura(SPELL_VENGEANCE_OF_THE_BLUE_FLIGHT,0)) break; - } - if (pTarget) - { - float x, y, z; - pTarget->GetPosition(x, y, z); - me->SummonCreature(CREATURE_ARMAGEDDON_TARGET, x,y,z,0, TEMPSUMMON_TIMED_DESPAWN,15000); - } - Timer[TIMER_ARMAGEDDON] = 2000; // No, I'm not kidding - break; - } - } - } - DoMeleeAttackIfReady(); - //Time runs over! - for (uint8 i = 0; i < ActiveTimers; ++i) - if (!TimerIsDeactivated[i]) - { - Timer[i] -= diff; - if (((int32)Timer[i]) < 0) Timer[i] = 0; + break; + case TIMER_FLAME_DART: //Phase 3 + DoCastAOE(SPELL_FLAME_DART, false); + Timer[TIMER_FLAME_DART] = 3000; //TODO Timer + break; + case TIMER_DARKNESS: //Phase 3 + if (!me->IsNonMeleeSpellCasted(false)) + { + // Begins to channel for 8 seconds, then deals 50'000 damage to all raid members. + if (!IsInDarkness) + { + DoScriptText(EMOTE_KJ_DARKNESS, me); + DoCastAOE(SPELL_DARKNESS_OF_A_THOUSAND_SOULS, false); + ChangeTimers(true, 9000); + Timer[TIMER_DARKNESS] = 8750; + TimerIsDeactivated[TIMER_DARKNESS] = false; + if (Phase == PHASE_SACRIFICE) + TimerIsDeactivated[TIMER_ARMAGEDDON] = false; + IsInDarkness = true; + } + else + { + Timer[TIMER_DARKNESS] = (Phase == PHASE_SACRIFICE) ? 15000 : urand(40000,70000); + IsInDarkness = false; + DoCastAOE(SPELL_DARKNESS_OF_A_THOUSAND_SOULS_DAMAGE); + DoScriptText(RAND(SAY_KJ_DARKNESS1,SAY_KJ_DARKNESS2,SAY_KJ_DARKNESS3), me); + } + Timer[TIMER_SOUL_FLAY] = 9000; + } + break; + case TIMER_ORBS_EMPOWER: //Phase 3 + if (Creature* pKalec = Unit::GetCreature(*me, pInstance->GetData64(DATA_KALECGOS_KJ))) + { + switch (Phase) + { + case PHASE_SACRIFICE: + CAST_AI(boss_kalecgos_kj::boss_kalecgos_kjAI, pKalec->AI())->EmpowerOrb(true); + break; + default: + CAST_AI(boss_kalecgos_kj::boss_kalecgos_kjAI, pKalec->AI())->EmpowerOrb(false); + break; + } + } + OrbActivated = true; + TimerIsDeactivated[TIMER_ORBS_EMPOWER] = true; + break; + case TIMER_ARMAGEDDON: //Phase 4 + Unit *pTarget; + for (uint8 z = 0; z < 6; ++z) + { + pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); + if (!pTarget || !pTarget->HasAura(SPELL_VENGEANCE_OF_THE_BLUE_FLIGHT,0)) break; + } + if (pTarget) + { + float x, y, z; + pTarget->GetPosition(x, y, z); + me->SummonCreature(CREATURE_ARMAGEDDON_TARGET, x,y,z,0, TEMPSUMMON_TIMED_DESPAWN,15000); + } + Timer[TIMER_ARMAGEDDON] = 2000; // No, I'm not kidding + break; + } + } } + DoMeleeAttackIfReady(); + //Time runs over! + for (uint8 i = 0; i < ActiveTimers; ++i) + if (!TimerIsDeactivated[i]) + { + Timer[i] -= diff; + if (((int32)Timer[i]) < 0) Timer[i] = 0; + } - //Phase 3 - if (Phase <= PHASE_NORMAL && !IsInDarkness) - { - if (Phase == PHASE_NORMAL && HealthBelowPct(85)) + //Phase 3 + if (Phase <= PHASE_NORMAL && !IsInDarkness) { - Phase = PHASE_DARKNESS; - ActiveTimers = 9; - EnterNextPhase(); + if (Phase == PHASE_NORMAL && HealthBelowPct(85)) + { + Phase = PHASE_DARKNESS; + ActiveTimers = 9; + EnterNextPhase(); + } + else return; } - else return; - } - //Phase 4 - if (Phase <= PHASE_DARKNESS && !IsInDarkness) - { - if (Phase == PHASE_DARKNESS && HealthBelowPct(55)) + //Phase 4 + if (Phase <= PHASE_DARKNESS && !IsInDarkness) { - Phase = PHASE_ARMAGEDDON; - ActiveTimers = 10; - EnterNextPhase(); + if (Phase == PHASE_DARKNESS && HealthBelowPct(55)) + { + Phase = PHASE_ARMAGEDDON; + ActiveTimers = 10; + EnterNextPhase(); + } + else return; } - else return; - } - //Phase 5 specific spells all we can - if (Phase <= PHASE_ARMAGEDDON && !IsInDarkness) - { - if (Phase == PHASE_ARMAGEDDON && HealthBelowPct(25)) + //Phase 5 specific spells all we can + if (Phase <= PHASE_ARMAGEDDON && !IsInDarkness) { - Phase = PHASE_SACRIFICE; - EnterNextPhase(); + if (Phase == PHASE_ARMAGEDDON && HealthBelowPct(25)) + { + Phase = PHASE_SACRIFICE; + EnterNextPhase(); + } + else return; } - else return; } - } + }; + }; -CreatureAI* GetAI_boss_kiljaeden(Creature* pCreature) -{ - return new boss_kiljaedenAI (pCreature); -} -//AI for Hand of the Deceiver -struct mob_hand_of_the_deceiverAI : public ScriptedAI +//AI for Hand of the Deceiver
class mob_hand_of_the_deceiver : public CreatureScript { - mob_hand_of_the_deceiverAI(Creature* c) : ScriptedAI(c) - { - pInstance = c->GetInstanceData(); - } - - ScriptedInstance* pInstance; - - uint32 ShadowBoltVolleyTimer; - uint32 FelfirePortalTimer; - - void Reset() - { - // TODO: Timers! - ShadowBoltVolleyTimer = urand(8000,14000); // So they don't all cast it in the same moment. - FelfirePortalTimer = 20000; - if (pInstance) - pInstance->SetData(DATA_KILJAEDEN_EVENT, NOT_STARTED); - } +public: + mob_hand_of_the_deceiver() : CreatureScript("mob_hand_of_the_deceiver") { } - void JustSummoned(Creature* summoned) + CreatureAI* GetAI(Creature* pCreature) const { - summoned->setFaction(me->getFaction()); - summoned->SetLevel(me->getLevel()); + return new mob_hand_of_the_deceiverAI (pCreature); } - void EnterCombat(Unit* who) + struct mob_hand_of_the_deceiverAI : public ScriptedAI { - if (pInstance) + mob_hand_of_the_deceiverAI(Creature* c) : ScriptedAI(c) { - pInstance->SetData(DATA_KILJAEDEN_EVENT, IN_PROGRESS); - if (Creature* pControl = Unit::GetCreature(*me, pInstance->GetData64(DATA_KILJAEDEN_CONTROLLER))) - pControl->AddThreat(who, 1.0f); + pInstance = c->GetInstanceScript(); } - me->InterruptNonMeleeSpells(true); - } - void JustDied(Unit* killer) - { - if (!pInstance) - return; + InstanceScript* pInstance; - if (Creature* pControl = Unit::GetCreature(*me, pInstance->GetData64(DATA_KILJAEDEN_CONTROLLER))) - ++(CAST_AI(mob_kiljaeden_controllerAI, pControl->AI())->deceiverDeathCount); - } + uint32 ShadowBoltVolleyTimer; + uint32 FelfirePortalTimer; - void UpdateAI(const uint32 diff) - { - if (!me->isInCombat()) - DoCast(me, SPELL_SHADOW_CHANNELING); + void Reset() + { + // TODO: Timers! + ShadowBoltVolleyTimer = urand(8000,14000); // So they don't all cast it in the same moment. + FelfirePortalTimer = 20000; + if (pInstance) + pInstance->SetData(DATA_KILJAEDEN_EVENT, NOT_STARTED); + } - if (!UpdateVictim()) - return; + void JustSummoned(Creature* summoned) + { + summoned->setFaction(me->getFaction()); + summoned->SetLevel(me->getLevel()); + } - // Gain Shadow Infusion at 20% health - if (HealthBelowPct(20) && !me->HasAura(SPELL_SHADOW_INFUSION, 0)) - DoCast(me, SPELL_SHADOW_INFUSION, true); + void EnterCombat(Unit* who) + { + if (pInstance) + { + pInstance->SetData(DATA_KILJAEDEN_EVENT, IN_PROGRESS); + if (Creature* pControl = Unit::GetCreature(*me, pInstance->GetData64(DATA_KILJAEDEN_CONTROLLER))) + pControl->AddThreat(who, 1.0f); + } + me->InterruptNonMeleeSpells(true); + } - // Shadow Bolt Volley - Shoots Shadow Bolts at all enemies within 30 yards, for ~2k Shadow damage. - if (ShadowBoltVolleyTimer <= diff) + void JustDied(Unit* killer) { - DoCast(me->getVictim(), SPELL_SHADOW_BOLT_VOLLEY); - ShadowBoltVolleyTimer = 12000; - } - else - ShadowBoltVolleyTimer -= diff; - - // Felfire Portal - Creatres a portal, that spawns Volatile Felfire Fiends, which do suicide bombing. - if (FelfirePortalTimer <= diff) + if (!pInstance) + return; + + if (Creature* pControl = Unit::GetCreature(*me, pInstance->GetData64(DATA_KILJAEDEN_CONTROLLER))) + ++(CAST_AI(mob_kiljaeden_controller::mob_kiljaeden_controllerAI, pControl->AI())->deceiverDeathCount); + } + + void UpdateAI(const uint32 diff) { - if (Creature* pPortal = DoSpawnCreature(CREATURE_FELFIRE_PORTAL, 0, 0,0, 0, TEMPSUMMON_TIMED_DESPAWN, 20000)) + if (!me->isInCombat()) + DoCast(me, SPELL_SHADOW_CHANNELING); + + if (!UpdateVictim()) + return; + + // Gain Shadow Infusion at 20% health + if (HealthBelowPct(20) && !me->HasAura(SPELL_SHADOW_INFUSION, 0)) + DoCast(me, SPELL_SHADOW_INFUSION, true); + + // Shadow Bolt Volley - Shoots Shadow Bolts at all enemies within 30 yards, for ~2k Shadow damage. + if (ShadowBoltVolleyTimer <= diff) { - std::list<HostileReference*>::iterator itr; - for (itr = me->getThreatManager().getThreatList().begin(); itr != me->getThreatManager().getThreatList().end(); ++itr) + DoCast(me->getVictim(), SPELL_SHADOW_BOLT_VOLLEY); + ShadowBoltVolleyTimer = 12000; + } + else + ShadowBoltVolleyTimer -= diff; + + // Felfire Portal - Creatres a portal, that spawns Volatile Felfire Fiends, which do suicide bombing. + if (FelfirePortalTimer <= diff) + { + if (Creature* pPortal = DoSpawnCreature(CREATURE_FELFIRE_PORTAL, 0, 0,0, 0, TEMPSUMMON_TIMED_DESPAWN, 20000)) { - Unit* pUnit = Unit::GetUnit(*me, (*itr)->getUnitGuid()); - if (pUnit) - pPortal->AddThreat(pUnit, 1.0f); + std::list<HostileReference*>::iterator itr; + for (itr = me->getThreatManager().getThreatList().begin(); itr != me->getThreatManager().getThreatList().end(); ++itr) + { + Unit* pUnit = Unit::GetUnit(*me, (*itr)->getUnitGuid()); + if (pUnit) + pPortal->AddThreat(pUnit, 1.0f); + } } - } - FelfirePortalTimer = 20000; - } else FelfirePortalTimer -= diff; + FelfirePortalTimer = 20000; + } else FelfirePortalTimer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_mob_hand_of_the_deceiver(Creature* pCreature) -{ - return new mob_hand_of_the_deceiverAI (pCreature); -} -//AI for Felfire Portal -struct mob_felfire_portalAI : public Scripted_NoMovementAI +//AI for Felfire Portal
class mob_felfire_portal : public CreatureScript { - mob_felfire_portalAI(Creature* c) : Scripted_NoMovementAI(c) {} - - uint32 uiSpawnFiendTimer; +public: + mob_felfire_portal() : CreatureScript("mob_felfire_portal") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - uiSpawnFiendTimer = 5000; - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_NON_ATTACKABLE); + return new mob_felfire_portalAI (pCreature); } - void JustSummoned(Creature* summoned) + struct mob_felfire_portalAI : public Scripted_NoMovementAI { - summoned->setFaction(me->getFaction()); - summoned->SetLevel(me->getLevel()); - } + mob_felfire_portalAI(Creature* c) : Scripted_NoMovementAI(c) {} - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + uint32 uiSpawnFiendTimer; - if (uiSpawnFiendTimer <= diff) + void Reset() { - if (Creature* pFiend = DoSpawnCreature(CREATURE_VOLATILE_FELFIRE_FIEND, 0, 0, 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 20000)) - pFiend->AddThreat(SelectUnit(SELECT_TARGET_RANDOM,0), 100000.0f); - uiSpawnFiendTimer = urand(4000,8000); - } else uiSpawnFiendTimer -= diff; - } -}; + uiSpawnFiendTimer = 5000; + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_NON_ATTACKABLE); + } -CreatureAI* GetAI_mob_felfire_portal(Creature* pCreature) -{ - return new mob_felfire_portalAI (pCreature); -} + void JustSummoned(Creature* summoned) + { + summoned->setFaction(me->getFaction()); + summoned->SetLevel(me->getLevel()); + } -//AI for Felfire Fiend -struct mob_volatile_felfire_fiendAI : public ScriptedAI -{ - mob_volatile_felfire_fiendAI(Creature* c) : ScriptedAI(c) {} + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; - uint32 uiExplodeTimer; + if (uiSpawnFiendTimer <= diff) + { + if (Creature* pFiend = DoSpawnCreature(CREATURE_VOLATILE_FELFIRE_FIEND, 0, 0, 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 20000)) + pFiend->AddThreat(SelectUnit(SELECT_TARGET_RANDOM,0), 100000.0f); + uiSpawnFiendTimer = urand(4000,8000); + } else uiSpawnFiendTimer -= diff; + } + }; - bool bLockedTarget; +}; - void Reset() - { - uiExplodeTimer = 2000; - bLockedTarget = false; - } - void DamageTaken(Unit *done_by, uint32 &damage) +//AI for Felfire Fiend
class mob_volatile_felfire_fiend : public CreatureScript +{ +public: + mob_volatile_felfire_fiend() : CreatureScript("mob_volatile_felfire_fiend") { } + + CreatureAI* GetAI(Creature* pCreature) const { - if (damage > me->GetHealth()) - DoCast(me, SPELL_FELFIRE_FISSION, true); + return new mob_volatile_felfire_fiendAI (pCreature); } - void UpdateAI(const uint32 diff) + struct mob_volatile_felfire_fiendAI : public ScriptedAI { - if (!UpdateVictim()) - return; + mob_volatile_felfire_fiendAI(Creature* c) : ScriptedAI(c) {} + + uint32 uiExplodeTimer; - if (!bLockedTarget) + bool bLockedTarget; + + void Reset() { - me->AddThreat(me->getVictim(), 10000000.0f); - bLockedTarget = true; + uiExplodeTimer = 2000; + bLockedTarget = false; } - if (uiExplodeTimer) + void DamageTaken(Unit *done_by, uint32 &damage) { - if (uiExplodeTimer <= diff) - uiExplodeTimer = 0; - else uiExplodeTimer -= diff; + if (damage > me->GetHealth()) + DoCast(me, SPELL_FELFIRE_FISSION, true); } - else if (me->IsWithinDistInMap(me->getVictim(), 3)) // Explode if it's close enough to it's target + + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_FELFIRE_FISSION); - me->Kill(me); + if (!UpdateVictim()) + return; + + if (!bLockedTarget) + { + me->AddThreat(me->getVictim(), 10000000.0f); + bLockedTarget = true; + } + + if (uiExplodeTimer) + { + if (uiExplodeTimer <= diff) + uiExplodeTimer = 0; + else uiExplodeTimer -= diff; + } + else if (me->IsWithinDistInMap(me->getVictim(), 3)) // Explode if it's close enough to it's target + { + DoCast(me->getVictim(), SPELL_FELFIRE_FISSION); + me->Kill(me); + } } - } + }; + }; -CreatureAI* GetAI_mob_volatile_felfire_fiend(Creature* pCreature) -{ - return new mob_volatile_felfire_fiendAI (pCreature); -} -//AI for Armageddon target -struct mob_armageddonAI : public Scripted_NoMovementAI +//AI for Armageddon target
class mob_armageddon : public CreatureScript { - mob_armageddonAI(Creature* c) : Scripted_NoMovementAI(c) {} +public: + mob_armageddon() : CreatureScript("mob_armageddon") { } - uint8 spell; - uint32 uiTimer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - spell = 0; - uiTimer = 0; + return new mob_armageddonAI (pCreature); } - void UpdateAI(const uint32 diff) + struct mob_armageddonAI : public Scripted_NoMovementAI { - if (uiTimer <= diff) + mob_armageddonAI(Creature* c) : Scripted_NoMovementAI(c) {} + + uint8 spell; + uint32 uiTimer; + + void Reset() { - switch(spell) + spell = 0; + uiTimer = 0; + } + + void UpdateAI(const uint32 diff) + { + if (uiTimer <= diff) { - case 0: - DoCast(me, SPELL_ARMAGEDDON_VISUAL, true); - ++spell; - break; - case 1: - DoCast(me, SPELL_ARMAGEDDON_VISUAL2, true); - uiTimer = 9000; - ++spell; - break; - case 2: - DoCast(me, SPELL_ARMAGEDDON_TRIGGER, true); - ++spell; - uiTimer = 5000; - break; - case 3: - me->Kill(me); - me->RemoveCorpse(); - break; - } - } else uiTimer -=diff; - } + switch(spell) + { + case 0: + DoCast(me, SPELL_ARMAGEDDON_VISUAL, true); + ++spell; + break; + case 1: + DoCast(me, SPELL_ARMAGEDDON_VISUAL2, true); + uiTimer = 9000; + ++spell; + break; + case 2: + DoCast(me, SPELL_ARMAGEDDON_TRIGGER, true); + ++spell; + uiTimer = 5000; + break; + case 3: + me->Kill(me); + me->RemoveCorpse(); + break; + } + } else uiTimer -=diff; + } + }; + }; -CreatureAI* GetAI_mob_armageddon(Creature* pCreature) -{ - return new mob_armageddonAI (pCreature); -} -//AI for Shield Orbs -struct mob_shield_orbAI : public ScriptedAI +//AI for Shield Orbs
class mob_shield_orb : public CreatureScript { - mob_shield_orbAI(Creature* c) : ScriptedAI(c) +public: + mob_shield_orb() : CreatureScript("mob_shield_orb") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new mob_shield_orbAI (pCreature); } - ScriptedInstance* pInstance; + struct mob_shield_orbAI : public ScriptedAI + { + mob_shield_orbAI(Creature* c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } - bool bPointReached; - bool bClockwise; - uint32 uiTimer; - uint32 uiCheckTimer; - float x, y, r, c, mx, my; + InstanceScript* pInstance; - void Reset() - { - me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); - bPointReached = true; - uiTimer = urand(500,1000); - uiCheckTimer = 1000; - r = 17; - c = 0; - mx = ShieldOrbLocations[0][0]; - my = ShieldOrbLocations[0][1]; - bClockwise = urand(0,1); - } + bool bPointReached; + bool bClockwise; + uint32 uiTimer; + uint32 uiCheckTimer; + float x, y, r, c, mx, my; - void UpdateAI(const uint32 diff) - { - if (bPointReached) + void Reset() + { + me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + bPointReached = true; + uiTimer = urand(500,1000); + uiCheckTimer = 1000; + r = 17; + c = 0; + mx = ShieldOrbLocations[0][0]; + my = ShieldOrbLocations[0][1]; + bClockwise = urand(0,1); + } + + void UpdateAI(const uint32 diff) { - if (bClockwise) + if (bPointReached) { - y = my - r * sin(c); - x = mx - r * cos(c); + if (bClockwise) + { + y = my - r * sin(c); + x = mx - r * cos(c); + } + else + { + y = my + r * sin(c); + x = mx + r * cos(c); + } + bPointReached = false; + uiCheckTimer = 1000; + me->GetMotionMaster()->MovePoint(1,x, y, SHIELD_ORB_Z); + c += M_PI/32; + if (c >= 2*M_PI) c = 0; } else { - y = my + r * sin(c); - x = mx + r * cos(c); + if (uiCheckTimer <= diff) + { + DoTeleportTo(x,y,SHIELD_ORB_Z); + bPointReached = true; + } + else uiCheckTimer -= diff; } - bPointReached = false; - uiCheckTimer = 1000; - me->GetMotionMaster()->MovePoint(1,x, y, SHIELD_ORB_Z); - c += M_PI/32; - if (c >= 2*M_PI) c = 0; - } - else - { - if (uiCheckTimer <= diff) + + if (uiTimer <= diff) { - DoTeleportTo(x,y,SHIELD_ORB_Z); - bPointReached = true; - } - else uiCheckTimer -= diff; + if (Unit* random = Unit::GetUnit(*me, pInstance ? pInstance->GetData64(DATA_PLAYER_GUID) : 0)) + DoCast(random, SPELL_SHADOW_BOLT, false); + uiTimer = urand(500,1000); + } else uiTimer -= diff; } - if (uiTimer <= diff) + void MovementInform(uint32 type, uint32 id) { - if (Unit* random = Unit::GetUnit(*me, pInstance ? pInstance->GetData64(DATA_PLAYER_GUID) : 0)) - DoCast(random, SPELL_SHADOW_BOLT, false); - uiTimer = urand(500,1000); - } else uiTimer -= diff; - } + if (type != POINT_MOTION_TYPE) + return; - void MovementInform(uint32 type, uint32 id) - { - if (type != POINT_MOTION_TYPE) - return; + bPointReached = true; + } + }; - bPointReached = true; - } }; -CreatureAI* GetAI_mob_shield_orb(Creature* pCreature) -{ - return new mob_shield_orbAI (pCreature); -} -//AI for Sinister Reflection -struct mob_sinster_reflectionAI : public ScriptedAI +//AI for Sinister Reflection
class mob_sinster_reflection : public CreatureScript { - mob_sinster_reflectionAI(Creature* c) : ScriptedAI(c) {} - - uint8 victimClass; - uint32 uiTimer[3]; +public: + mob_sinster_reflection() : CreatureScript("mob_sinster_reflection") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - uiTimer[0] = 0; - uiTimer[1] = 0; - uiTimer[2] = 0; - victimClass = 0; + return new mob_sinster_reflectionAI (pCreature); } - void UpdateAI(const uint32 diff) + struct mob_sinster_reflectionAI : public ScriptedAI { - if (!UpdateVictim()) - return; + mob_sinster_reflectionAI(Creature* c) : ScriptedAI(c) {} - if ((victimClass == 0) && me->getVictim()) + uint8 victimClass; + uint32 uiTimer[3]; + + void Reset() { - victimClass = me->getVictim()->getClass(); - switch (victimClass) + uiTimer[0] = 0; + uiTimer[1] = 0; + uiTimer[2] = 0; + victimClass = 0; + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if ((victimClass == 0) && me->getVictim()) { + victimClass = me->getVictim()->getClass(); + switch (victimClass) + { + case CLASS_DRUID: + break; + case CLASS_HUNTER: + break; + case CLASS_MAGE: + break; + case CLASS_WARLOCK: + break; + case CLASS_WARRIOR: + me->SetCanDualWield(true); + break; + case CLASS_PALADIN: + break; + case CLASS_PRIEST: + break; + case CLASS_SHAMAN: + me->SetCanDualWield(true); + break; + case CLASS_ROGUE: + me->SetCanDualWield(true); + break; + } + } + + switch(victimClass) { case CLASS_DRUID: + if (uiTimer[1] <= diff) + { + DoCast(me->getVictim(), SPELL_SR_MOONFIRE, false); + uiTimer[1] = urand(2000,4000); + } + DoMeleeAttackIfReady(); break; case CLASS_HUNTER: + if (uiTimer[1] <= diff) + { + DoCast(me->getVictim(), SPELL_SR_MULTI_SHOT, false); + uiTimer[1] = urand(8000,10000); + } + if (uiTimer[2] <= diff) + { + DoCast(me->getVictim(), SPELL_SR_SHOOT, false); + uiTimer[2] = urand(4000,6000); + } + if (me->IsWithinMeleeRange(me->getVictim(), 6)) + { + if (uiTimer[0] <= diff) + { + DoCast(me->getVictim(), SPELL_SR_MULTI_SHOT, false); + uiTimer[0] = urand(6000,8000); + } + DoMeleeAttackIfReady(); + } break; case CLASS_MAGE: + if (uiTimer[1] <= diff) + { + DoCast(me->getVictim(), SPELL_SR_FIREBALL, false); + uiTimer[1] = urand(2000,4000); + } + DoMeleeAttackIfReady(); break; case CLASS_WARLOCK: + if (uiTimer[1] <= diff) + { + DoCast(me->getVictim(), SPELL_SR_SHADOW_BOLT, false); + uiTimer[1] = urand(3000,5000); + } + if (uiTimer[2] <= diff) + { + DoCast(SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true), SPELL_SR_CURSE_OF_AGONY, true); + uiTimer[2] = urand(2000,4000); + } + DoMeleeAttackIfReady(); break; case CLASS_WARRIOR: - me->SetCanDualWield(true); + if (uiTimer[1] <= diff) + { + DoCast(me->getVictim(), SPELL_SR_WHIRLWIND, false); + uiTimer[1] = urand(9000,11000); + } + DoMeleeAttackIfReady(); break; case CLASS_PALADIN: + if (uiTimer[1] <= diff) + { + DoCast(me->getVictim(), SPELL_SR_HAMMER_OF_JUSTICE, false); + uiTimer[1] = urand(6000,8000); + } + if (uiTimer[2] <= diff) + { + DoCast(me->getVictim(), SPELL_SR_HOLY_SHOCK, false); + uiTimer[2] = urand(2000,4000); + } + DoMeleeAttackIfReady(); break; case CLASS_PRIEST: + if (uiTimer[1] <= diff) + { + DoCast(me->getVictim(), SPELL_SR_HOLY_SMITE, false); + uiTimer[1] = urand(4000,6000); + } + if (uiTimer[2] <= diff) + { + DoCast(me, SPELL_SR_RENEW, false); + uiTimer[2] = urand(6000,8000); + } + DoMeleeAttackIfReady(); break; case CLASS_SHAMAN: - me->SetCanDualWield(true); + if (uiTimer[1] <= diff) + { + DoCast(me->getVictim(), SPELL_SR_EARTH_SHOCK, false); + uiTimer[1] = urand(4000,6000); + } + DoMeleeAttackIfReady(); break; case CLASS_ROGUE: - me->SetCanDualWield(true); - break; - } - } - - switch(victimClass) { - case CLASS_DRUID: - if (uiTimer[1] <= diff) - { - DoCast(me->getVictim(), SPELL_SR_MOONFIRE, false); - uiTimer[1] = urand(2000,4000); - } - DoMeleeAttackIfReady(); - break; - case CLASS_HUNTER: - if (uiTimer[1] <= diff) - { - DoCast(me->getVictim(), SPELL_SR_MULTI_SHOT, false); - uiTimer[1] = urand(8000,10000); - } - if (uiTimer[2] <= diff) - { - DoCast(me->getVictim(), SPELL_SR_SHOOT, false); - uiTimer[2] = urand(4000,6000); - } - if (me->IsWithinMeleeRange(me->getVictim(), 6)) - { - if (uiTimer[0] <= diff) + if (uiTimer[1] <= diff) { - DoCast(me->getVictim(), SPELL_SR_MULTI_SHOT, false); - uiTimer[0] = urand(6000,8000); + DoCast(me->getVictim(), SPELL_SR_HEMORRHAGE, true); + uiTimer[1] = urand(4000,6000); } DoMeleeAttackIfReady(); + break; } - break; - case CLASS_MAGE: - if (uiTimer[1] <= diff) - { - DoCast(me->getVictim(), SPELL_SR_FIREBALL, false); - uiTimer[1] = urand(2000,4000); - } - DoMeleeAttackIfReady(); - break; - case CLASS_WARLOCK: - if (uiTimer[1] <= diff) - { - DoCast(me->getVictim(), SPELL_SR_SHADOW_BOLT, false); - uiTimer[1] = urand(3000,5000); - } - if (uiTimer[2] <= diff) - { - DoCast(SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true), SPELL_SR_CURSE_OF_AGONY, true); - uiTimer[2] = urand(2000,4000); - } - DoMeleeAttackIfReady(); - break; - case CLASS_WARRIOR: - if (uiTimer[1] <= diff) - { - DoCast(me->getVictim(), SPELL_SR_WHIRLWIND, false); - uiTimer[1] = urand(9000,11000); - } - DoMeleeAttackIfReady(); - break; - case CLASS_PALADIN: - if (uiTimer[1] <= diff) - { - DoCast(me->getVictim(), SPELL_SR_HAMMER_OF_JUSTICE, false); - uiTimer[1] = urand(6000,8000); - } - if (uiTimer[2] <= diff) - { - DoCast(me->getVictim(), SPELL_SR_HOLY_SHOCK, false); - uiTimer[2] = urand(2000,4000); - } - DoMeleeAttackIfReady(); - break; - case CLASS_PRIEST: - if (uiTimer[1] <= diff) - { - DoCast(me->getVictim(), SPELL_SR_HOLY_SMITE, false); - uiTimer[1] = urand(4000,6000); - } - if (uiTimer[2] <= diff) - { - DoCast(me, SPELL_SR_RENEW, false); - uiTimer[2] = urand(6000,8000); - } - DoMeleeAttackIfReady(); - break; - case CLASS_SHAMAN: - if (uiTimer[1] <= diff) - { - DoCast(me->getVictim(), SPELL_SR_EARTH_SHOCK, false); - uiTimer[1] = urand(4000,6000); - } - DoMeleeAttackIfReady(); - break; - case CLASS_ROGUE: - if (uiTimer[1] <= diff) - { - DoCast(me->getVictim(), SPELL_SR_HEMORRHAGE, true); - uiTimer[1] = urand(4000,6000); - } - DoMeleeAttackIfReady(); - break; + sLog.outDebug("Sinister-Timer"); + for (uint8 i = 0; i < 3; ++i) + uiTimer[i] -= diff; } - sLog.outDebug("Sinister-Timer"); - for (uint8 i = 0; i < 3; ++i) - uiTimer[i] -= diff; - } + }; + }; -CreatureAI* GetAI_mob_sinster_reflection(Creature* pCreature) -{ - return new mob_sinster_reflectionAI (pCreature); -} void AddSC_boss_kiljaeden() { - Script* newscript; - - newscript = new Script; - newscript->pGOHello = &GOHello_go_orb_of_the_blue_flight; - newscript->Name = "go_orb_of_the_blue_flight"; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->GetAI = &GetAI_boss_kalecgos_kj; - newscript->Name = "boss_kalecgos_kj"; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->GetAI = &GetAI_boss_kiljaeden; - newscript->Name = "boss_kiljaeden"; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->GetAI = &GetAI_mob_kiljaeden_controller; - newscript->Name = "mob_kiljaeden_controller"; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->GetAI = &GetAI_mob_hand_of_the_deceiver; - newscript->Name = "mob_hand_of_the_deceiver"; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->GetAI = &GetAI_mob_felfire_portal; - newscript->Name = "mob_felfire_portal"; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->GetAI = &GetAI_mob_volatile_felfire_fiend; - newscript->Name = "mob_volatile_felfire_fiend"; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->GetAI = &GetAI_mob_armageddon; - newscript->Name = "mob_armageddon"; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->GetAI = &GetAI_mob_shield_orb; - newscript->Name = "mob_shield_orb"; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->GetAI = &GetAI_mob_sinster_reflection; - newscript->Name = "mob_sinster_reflection"; - newscript->RegisterSelf(); + new go_orb_of_the_blue_flight(); + new boss_kalecgos_kj(); + new boss_kiljaeden(); + new mob_kiljaeden_controller(); + new mob_hand_of_the_deceiver(); + new mob_felfire_portal(); + new mob_volatile_felfire_fiend(); + new mob_armageddon(); + new mob_shield_orb(); + new mob_sinster_reflection(); } diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp index 1fa61f85a80..7bb1156b740 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp @@ -100,542 +100,560 @@ float Humanoides[6][5] = {CREATURE_BERSERKER, 1842.91, 599.93, 71.23, 2.44} }; -uint32 EnrageTimer = 600000; -struct boss_entropiusAI : public ScriptedAI +uint32 EnrageTimer = 600000;
class boss_entropius : public CreatureScript { - boss_entropiusAI(Creature *c) : ScriptedAI(c), Summons(me) +public: + boss_entropius() : CreatureScript("boss_entropius") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_entropiusAI (pCreature); } - ScriptedInstance* pInstance; - SummonList Summons; - - uint32 BlackHoleSummonTimer; - - void Reset() + struct boss_entropiusAI : public ScriptedAI { - BlackHoleSummonTimer = 15000; - DoCastAOE(SPELL_NEGATIVE_ENERGY_E, false); + boss_entropiusAI(Creature *c) : ScriptedAI(c), Summons(me) + { + pInstance = c->GetInstanceScript(); + } - Summons.DespawnAll(); + InstanceScript* pInstance; + SummonList Summons; - if (pInstance) - pInstance->SetData(DATA_MURU_EVENT, NOT_STARTED); - } + uint32 BlackHoleSummonTimer; - void EnterCombat(Unit * /*who*/) - { - DoCastAOE(SPELL_NEGATIVE_ENERGY_E, true); - DoCast(me, SPELL_ENTROPIUS_SPAWN, false); + void Reset() + { + BlackHoleSummonTimer = 15000; + DoCastAOE(SPELL_NEGATIVE_ENERGY_E, false); - if (pInstance) - pInstance->SetData(DATA_MURU_EVENT, IN_PROGRESS); - } + Summons.DespawnAll(); - void JustSummoned(Creature* summoned) - { - switch(summoned->GetEntry()) - { - case CREATURE_DARK_FIENDS: - summoned->CastSpell(summoned,SPELL_DARKFIEND_VISUAL,false); - break; - case CREATURE_DARKNESS: - summoned->addUnitState(UNIT_STAT_STUNNED); - float x,y,z,o; - summoned->GetHomePosition(x,y,z,o); - me->SummonCreature(CREATURE_DARK_FIENDS, x,y,z,o, TEMPSUMMON_CORPSE_DESPAWN, 0); - break; + if (pInstance) + pInstance->SetData(DATA_MURU_EVENT, NOT_STARTED); } - summoned->AI()->AttackStart(SelectTarget(SELECT_TARGET_RANDOM,0, 50, true)); - Summons.Summon(summoned); - } - void JustDied(Unit* /*killer*/) - { - Summons.DespawnAll(); + void EnterCombat(Unit * /*who*/) + { + DoCastAOE(SPELL_NEGATIVE_ENERGY_E, true); + DoCast(me, SPELL_ENTROPIUS_SPAWN, false); - if (pInstance) - pInstance->SetData(DATA_MURU_EVENT, DONE); - } + if (pInstance) + pInstance->SetData(DATA_MURU_EVENT, IN_PROGRESS); + } - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + void JustSummoned(Creature* summoned) + { + switch(summoned->GetEntry()) + { + case CREATURE_DARK_FIENDS: + summoned->CastSpell(summoned,SPELL_DARKFIEND_VISUAL,false); + break; + case CREATURE_DARKNESS: + summoned->addUnitState(UNIT_STAT_STUNNED); + float x,y,z,o; + summoned->GetHomePosition(x,y,z,o); + me->SummonCreature(CREATURE_DARK_FIENDS, x,y,z,o, TEMPSUMMON_CORPSE_DESPAWN, 0); + break; + } + summoned->AI()->AttackStart(SelectTarget(SELECT_TARGET_RANDOM,0, 50, true)); + Summons.Summon(summoned); + } - if (EnrageTimer < diff && !me->HasAura(SPELL_ENRAGE, 0)) + void JustDied(Unit* /*killer*/) { - DoCast(me, SPELL_ENRAGE, false); - } else EnrageTimer -= diff; + Summons.DespawnAll(); + + if (pInstance) + pInstance->SetData(DATA_MURU_EVENT, DONE); + } - if (BlackHoleSummonTimer <= diff) + void UpdateAI(const uint32 diff) { - Unit* random = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); - if (!random) + if (!UpdateVictim()) return; - DoCast(random, SPELL_DARKNESS_E, false); + if (EnrageTimer < diff && !me->HasAura(SPELL_ENRAGE, 0)) + { + DoCast(me, SPELL_ENRAGE, false); + } else EnrageTimer -= diff; - random = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); - if (!random) - return; + if (BlackHoleSummonTimer <= diff) + { + Unit* random = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); + if (!random) + return; - random->CastSpell(random, SPELL_BLACKHOLE, false); - BlackHoleSummonTimer = 15000; - } else BlackHoleSummonTimer -= diff; + DoCast(random, SPELL_DARKNESS_E, false); + + random = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); + if (!random) + return; + + random->CastSpell(random, SPELL_BLACKHOLE, false); + BlackHoleSummonTimer = 15000; + } else BlackHoleSummonTimer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_entropius(Creature* pCreature) +
class boss_muru : public CreatureScript { - return new boss_entropiusAI (pCreature); -} +public: + boss_muru() : CreatureScript("boss_muru") { } -struct boss_muruAI : public Scripted_NoMovementAI -{ - boss_muruAI(Creature *c) : Scripted_NoMovementAI(c), Summons(me) + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_muruAI (pCreature); } - ScriptedInstance* pInstance; - SummonList Summons; - - uint8 Phase; - uint32 Timer[4]; + struct boss_muruAI : public Scripted_NoMovementAI + { + boss_muruAI(Creature *c) : Scripted_NoMovementAI(c), Summons(me) + { + pInstance = c->GetInstanceScript(); + } - bool DarkFiend; + InstanceScript* pInstance; + SummonList Summons; - void Reset() - { - DarkFiend = false; - Phase = 1; + uint8 Phase; + uint32 Timer[4]; - EnrageTimer = 600000; - Timer[TIMER_DARKNESS] = 45000; - Timer[TIMER_HUMANOIDES] = 10000; - Timer[TIMER_PHASE] = 2000; - Timer[TIMER_SENTINEL] = 31500; + bool DarkFiend; - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->SetVisibility(VISIBILITY_ON); + void Reset() + { + DarkFiend = false; + Phase = 1; - Summons.DespawnAll(); + EnrageTimer = 600000; + Timer[TIMER_DARKNESS] = 45000; + Timer[TIMER_HUMANOIDES] = 10000; + Timer[TIMER_PHASE] = 2000; + Timer[TIMER_SENTINEL] = 31500; - if (pInstance) - pInstance->SetData(DATA_MURU_EVENT, NOT_STARTED); - } + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetVisibility(VISIBILITY_ON); - void EnterCombat(Unit * /*who*/) - { - DoCastAOE(SPELL_NEGATIVE_ENERGY,false); + Summons.DespawnAll(); - if (pInstance) - pInstance->SetData(DATA_MURU_EVENT, IN_PROGRESS); - } + if (pInstance) + pInstance->SetData(DATA_MURU_EVENT, NOT_STARTED); + } - void DamageTaken(Unit * /*done_by*/, uint32 &damage) - { - if (damage > me->GetHealth() && Phase == 1) + void EnterCombat(Unit * /*who*/) { - damage = 0; - Phase = 2; - me->RemoveAllAuras(); - DoCast(me, SPELL_OPEN_ALL_PORTALS, false); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + DoCastAOE(SPELL_NEGATIVE_ENERGY,false); + + if (pInstance) + pInstance->SetData(DATA_MURU_EVENT, IN_PROGRESS); } - if (Phase > 1 && Phase < 4) - damage = 0; - } - void JustSummoned(Creature* summoned) - { - switch(summoned->GetEntry()) + void DamageTaken(Unit * /*done_by*/, uint32 &damage) { - case BOSS_ENTROPIUS: - me->SetVisibility(VISIBILITY_OFF); - break; - case CREATURE_DARK_FIENDS: - summoned->CastSpell(summoned,SPELL_DARKFIEND_VISUAL,false); - break; + if (damage > me->GetHealth() && Phase == 1) + { + damage = 0; + Phase = 2; + me->RemoveAllAuras(); + DoCast(me, SPELL_OPEN_ALL_PORTALS, false); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + } + if (Phase > 1 && Phase < 4) + damage = 0; } - summoned->AI()->AttackStart(SelectTarget(SELECT_TARGET_RANDOM,0, 50, true)); - Summons.Summon(summoned); - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - if (Phase == 3) + void JustSummoned(Creature* summoned) { - if (Timer[TIMER_PHASE] <= diff) + switch(summoned->GetEntry()) { - if (!pInstance) - return; - switch(pInstance->GetData(DATA_MURU_EVENT)) - { - case NOT_STARTED: - Reset(); - break; - case DONE: - Phase = 4; - me->DisappearAndDie(); - break; - } - Timer[TIMER_PHASE] = 3000; - } else Timer[TIMER_PHASE] -= diff; - return; + case BOSS_ENTROPIUS: + me->SetVisibility(VISIBILITY_OFF); + break; + case CREATURE_DARK_FIENDS: + summoned->CastSpell(summoned,SPELL_DARKFIEND_VISUAL,false); + break; + } + summoned->AI()->AttackStart(SelectTarget(SELECT_TARGET_RANDOM,0, 50, true)); + Summons.Summon(summoned); } - if (EnrageTimer < diff && !me->HasAura(SPELL_ENRAGE, 0)) + void UpdateAI(const uint32 diff) { - DoCast(me, SPELL_ENRAGE, false); - } else EnrageTimer -= diff; + if (!UpdateVictim()) + return; - for (uint8 i = 0; i < 4; ++i) - { - if (Timer[i] <= diff) + if (Phase == 3) { - switch(i) + if (Timer[TIMER_PHASE] <= diff) { - case TIMER_DARKNESS: - if (!DarkFiend) - { - DoCastAOE(SPELL_DARKNESS, false); - Timer[TIMER_DARKNESS] = 3000; - DarkFiend = true; - } - else - { - DarkFiend = false; - for (uint8 i = 0; i < 8; ++i) - me->SummonCreature(CREATURE_DARK_FIENDS,DarkFiends[i][0],DarkFiends[i][1],DarkFiends[i][2], DarkFiends[i][3], TEMPSUMMON_CORPSE_DESPAWN, 0); - Timer[TIMER_DARKNESS] = 42000; - } - break; - case TIMER_HUMANOIDES: - for (uint8 i = 0; i < 6; ++i) - me->SummonCreature(Humanoides[i][0],Humanoides[i][1],Humanoides[i][2],Humanoides[i][3], Humanoides[i][4], TEMPSUMMON_CORPSE_DESPAWN, 0); - Timer[TIMER_HUMANOIDES] = 60000; - break; - case TIMER_PHASE: - me->RemoveAllAuras(); - DoCast(me, SPELL_SUMMON_ENTROPIUS, false); - Timer[TIMER_PHASE] = 3000; - Phase = 3; + if (!pInstance) return; - case TIMER_SENTINEL: - DoCastAOE(SPELL_OPEN_PORTAL_2, false); - Timer[TIMER_SENTINEL] = 30000; - break; + switch(pInstance->GetData(DATA_MURU_EVENT)) + { + case NOT_STARTED: + Reset(); + break; + case DONE: + Phase = 4; + me->DisappearAndDie(); + break; + } + Timer[TIMER_PHASE] = 3000; + } else Timer[TIMER_PHASE] -= diff; + return; + } + + if (EnrageTimer < diff && !me->HasAura(SPELL_ENRAGE, 0)) + { + DoCast(me, SPELL_ENRAGE, false); + } else EnrageTimer -= diff; + + for (uint8 i = 0; i < 4; ++i) + { + if (Timer[i] <= diff) + { + switch(i) + { + case TIMER_DARKNESS: + if (!DarkFiend) + { + DoCastAOE(SPELL_DARKNESS, false); + Timer[TIMER_DARKNESS] = 3000; + DarkFiend = true; + } + else + { + DarkFiend = false; + for (uint8 i = 0; i < 8; ++i) + me->SummonCreature(CREATURE_DARK_FIENDS,DarkFiends[i][0],DarkFiends[i][1],DarkFiends[i][2], DarkFiends[i][3], TEMPSUMMON_CORPSE_DESPAWN, 0); + Timer[TIMER_DARKNESS] = 42000; + } + break; + case TIMER_HUMANOIDES: + for (uint8 i = 0; i < 6; ++i) + me->SummonCreature(Humanoides[i][0],Humanoides[i][1],Humanoides[i][2],Humanoides[i][3], Humanoides[i][4], TEMPSUMMON_CORPSE_DESPAWN, 0); + Timer[TIMER_HUMANOIDES] = 60000; + break; + case TIMER_PHASE: + me->RemoveAllAuras(); + DoCast(me, SPELL_SUMMON_ENTROPIUS, false); + Timer[TIMER_PHASE] = 3000; + Phase = 3; + return; + case TIMER_SENTINEL: + DoCastAOE(SPELL_OPEN_PORTAL_2, false); + Timer[TIMER_SENTINEL] = 30000; + break; + } + break; } - break; } - } - //Timer - for (uint8 i = 0; i < 4; ++i) - { - if (i != TIMER_PHASE)Timer[i] -= diff; - else if (Phase == 2) Timer[i] -= diff; + //Timer + for (uint8 i = 0; i < 4; ++i) + { + if (i != TIMER_PHASE)Timer[i] -= diff; + else if (Phase == 2) Timer[i] -= diff; + } } - } + }; + }; -CreatureAI* GetAI_boss_muru(Creature* pCreature) +
class npc_muru_portal : public CreatureScript { - return new boss_muruAI (pCreature); -} +public: + npc_muru_portal() : CreatureScript("npc_muru_portal") { } -struct npc_muru_portalAI : public Scripted_NoMovementAI -{ - npc_muru_portalAI(Creature *c) : Scripted_NoMovementAI(c), Summons(me) + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new npc_muru_portalAI (pCreature); } - ScriptedInstance* pInstance; - - SummonList Summons; + struct npc_muru_portalAI : public Scripted_NoMovementAI + { + npc_muru_portalAI(Creature *c) : Scripted_NoMovementAI(c), Summons(me) + { + pInstance = c->GetInstanceScript(); + } - bool SummonSentinel; - bool InAction; + InstanceScript* pInstance; - uint32 SummonTimer; + SummonList Summons; - void Reset() - { - SummonTimer = 5000; + bool SummonSentinel; + bool InAction; - InAction = false; - SummonSentinel = false; + uint32 SummonTimer; - me->addUnitState(UNIT_STAT_STUNNED); + void Reset() + { + SummonTimer = 5000; - Summons.DespawnAll(); - } + InAction = false; + SummonSentinel = false; - void JustSummoned(Creature* summoned) - { - if (pInstance) - if (Player* Target = Unit::GetPlayer(*me, pInstance->GetData64(DATA_PLAYER_GUID))) - summoned->AI()->AttackStart(Target); + me->addUnitState(UNIT_STAT_STUNNED); - Summons.Summon(summoned); - } + Summons.DespawnAll(); + } - void SpellHit(Unit* /*caster*/, const SpellEntry* Spell) - { - float x,y,z,o; - me->GetHomePosition(x,y,z,o); - DoTeleportTo(x,y,z); - InAction = true; - switch(Spell->Id) + void JustSummoned(Creature* summoned) { - case SPELL_OPEN_ALL_PORTALS: - DoCastAOE(SPELL_OPEN_PORTAL, false); - break; - case SPELL_OPEN_PORTAL_2: - DoCastAOE(SPELL_OPEN_PORTAL, false); - SummonSentinel = true; - break; + if (pInstance) + if (Player* Target = Unit::GetPlayer(*me, pInstance->GetData64(DATA_PLAYER_GUID))) + summoned->AI()->AttackStart(Target); + + Summons.Summon(summoned); } - } - void UpdateAI(const uint32 diff) - { - if (!SummonSentinel) + void SpellHit(Unit* /*caster*/, const SpellEntry* Spell) { - if (InAction && pInstance && pInstance->GetData(DATA_MURU_EVENT) == NOT_STARTED) - Reset(); - return; + float x,y,z,o; + me->GetHomePosition(x,y,z,o); + DoTeleportTo(x,y,z); + InAction = true; + switch(Spell->Id) + { + case SPELL_OPEN_ALL_PORTALS: + DoCastAOE(SPELL_OPEN_PORTAL, false); + break; + case SPELL_OPEN_PORTAL_2: + DoCastAOE(SPELL_OPEN_PORTAL, false); + SummonSentinel = true; + break; + } } - if (SummonTimer <= diff) + + void UpdateAI(const uint32 diff) { - DoCastAOE(SPELL_SUMMON_VOID_SENTINEL, false); - SummonTimer = 5000; - SummonSentinel = false; - } else SummonTimer -= diff; - } -}; + if (!SummonSentinel) + { + if (InAction && pInstance && pInstance->GetData(DATA_MURU_EVENT) == NOT_STARTED) + Reset(); + return; + } + if (SummonTimer <= diff) + { + DoCastAOE(SPELL_SUMMON_VOID_SENTINEL, false); + SummonTimer = 5000; + SummonSentinel = false; + } else SummonTimer -= diff; + } + }; -CreatureAI* GetAI_npc_muru_portal(Creature* pCreature) -{ - return new npc_muru_portalAI (pCreature); -} +}; -struct npc_dark_fiendAI : public ScriptedAI +
class npc_dark_fiend : public CreatureScript { - npc_dark_fiendAI(Creature *c) : ScriptedAI(c) {} +public: + npc_dark_fiend() : CreatureScript("npc_dark_fiend") { } - uint32 WaitTimer; - bool InAction; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - WaitTimer = 2000; - InAction = false; - - me->addUnitState(UNIT_STAT_STUNNED); + return new npc_dark_fiendAI (pCreature); } - void SpellHit(Unit* /*caster*/, const SpellEntry* Spell) + struct npc_dark_fiendAI : public ScriptedAI { - for (uint8 i = 0; i < 3; ++i) - if (Spell->Effect[i] == 38) - me->DisappearAndDie(); - } + npc_dark_fiendAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + uint32 WaitTimer; + bool InAction; - if (WaitTimer <= diff) + void Reset() { - if (!InAction) - { - me->clearUnitState(UNIT_STAT_STUNNED); - DoCastAOE(SPELL_DARKFIEND_SKIN, false); - AttackStart(SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)); - InAction = true; - WaitTimer = 500; - } - else - { + WaitTimer = 2000; + InAction = false; - if (me->IsWithinDist(me->getVictim(), 5)) - { - DoCastAOE(SPELL_DARKFIEND_AOE, false); + me->addUnitState(UNIT_STAT_STUNNED); + } + + void SpellHit(Unit* /*caster*/, const SpellEntry* Spell) + { + for (uint8 i = 0; i < 3; ++i) + if (Spell->Effect[i] == 38) me->DisappearAndDie(); - } - WaitTimer = 500; - } - } else WaitTimer -= diff; - } -}; + } -CreatureAI* GetAI_npc_dark_fiend(Creature* pCreature) -{ - return new npc_dark_fiendAI (pCreature); -} + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; -struct npc_void_sentinelAI : public ScriptedAI -{ - npc_void_sentinelAI(Creature *c) : ScriptedAI(c){} + if (WaitTimer <= diff) + { + if (!InAction) + { + me->clearUnitState(UNIT_STAT_STUNNED); + DoCastAOE(SPELL_DARKFIEND_SKIN, false); + AttackStart(SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)); + InAction = true; + WaitTimer = 500; + } + else + { - uint32 PulseTimer; - uint32 VoidBlastTimer; + if (me->IsWithinDist(me->getVictim(), 5)) + { + DoCastAOE(SPELL_DARKFIEND_AOE, false); + me->DisappearAndDie(); + } + WaitTimer = 500; + } + } else WaitTimer -= diff; + } + }; - void Reset() - { - PulseTimer = 3000; - VoidBlastTimer = 45000; //is this a correct timer? +}; - float x,y,z,o; - me->GetHomePosition(x,y,z,o); - DoTeleportTo(x,y,71); - } +
class npc_void_sentinel : public CreatureScript +{ +public: + npc_void_sentinel() : CreatureScript("npc_void_sentinel") { } - void JustDied(Unit* /*killer*/) + CreatureAI* GetAI(Creature* pCreature) const { - for (uint8 i = 0; i < 8; ++i) - me->SummonCreature(CREATURE_VOID_SPAWN, me->GetPositionX(),me->GetPositionY(),me->GetPositionZ(), rand()%6, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 180000); + return new npc_void_sentinelAI (pCreature); } - void UpdateAI(const uint32 diff) + struct npc_void_sentinelAI : public ScriptedAI { - if (!UpdateVictim()) - return; + npc_void_sentinelAI(Creature *c) : ScriptedAI(c){} - if (PulseTimer <= diff) + uint32 PulseTimer; + uint32 VoidBlastTimer; + + void Reset() { - DoCastAOE(SPELL_SHADOW_PULSE, true); PulseTimer = 3000; - } else PulseTimer -= diff; + VoidBlastTimer = 45000; //is this a correct timer? + + float x,y,z,o; + me->GetHomePosition(x,y,z,o); + DoTeleportTo(x,y,71); + } - if (VoidBlastTimer <= diff) + void JustDied(Unit* /*killer*/) { - DoCast(me->getVictim(), SPELL_VOID_BLAST, false); - VoidBlastTimer = 45000; - } else VoidBlastTimer -= diff; + for (uint8 i = 0; i < 8; ++i) + me->SummonCreature(CREATURE_VOID_SPAWN, me->GetPositionX(),me->GetPositionY(),me->GetPositionZ(), rand()%6, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 180000); + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if (PulseTimer <= diff) + { + DoCastAOE(SPELL_SHADOW_PULSE, true); + PulseTimer = 3000; + } else PulseTimer -= diff; + + if (VoidBlastTimer <= diff) + { + DoCast(me->getVictim(), SPELL_VOID_BLAST, false); + VoidBlastTimer = 45000; + } else VoidBlastTimer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_npc_void_sentinel(Creature* pCreature) +
class npc_blackhole : public CreatureScript { - return new npc_void_sentinelAI (pCreature); -} +public: + npc_blackhole() : CreatureScript("npc_blackhole") { } -struct npc_blackholeAI : public ScriptedAI -{ - npc_blackholeAI(Creature *c) : ScriptedAI(c) + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new npc_blackholeAI (pCreature); } - ScriptedInstance* pInstance; + struct npc_blackholeAI : public ScriptedAI + { + npc_blackholeAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } - uint32 DespawnTimer; - uint32 SpellTimer; - uint8 Phase; - uint8 NeedForAHack; + InstanceScript* pInstance; - void Reset() - { - DespawnTimer = 15000; - SpellTimer = 5000; - Phase = 0; + uint32 DespawnTimer; + uint32 SpellTimer; + uint8 Phase; + uint8 NeedForAHack; - me->addUnitState(UNIT_STAT_STUNNED); - DoCastAOE(SPELL_BLACKHOLE_SPAWN, true); - } + void Reset() + { + DespawnTimer = 15000; + SpellTimer = 5000; + Phase = 0; - void UpdateAI(const uint32 diff) - { - if (SpellTimer <= diff) + me->addUnitState(UNIT_STAT_STUNNED); + DoCastAOE(SPELL_BLACKHOLE_SPAWN, true); + } + + void UpdateAI(const uint32 diff) { - Unit* Victim = Unit::GetUnit(*me, pInstance ? pInstance->GetData64(DATA_PLAYER_GUID) : 0); - switch (NeedForAHack) + if (SpellTimer <= diff) { - case 0: - me->clearUnitState(UNIT_STAT_STUNNED); - DoCastAOE(SPELL_BLACKHOLE_GROW, false); - if (Victim) - AttackStart(Victim); - SpellTimer = 700; - NeedForAHack = 2; - break; - case 1: - me->AddAura(SPELL_BLACKHOLE_GROW, me); - NeedForAHack = 2; - SpellTimer = 600; - break; - case 2: - SpellTimer = 400; - NeedForAHack = 3; - me->RemoveAura(SPELL_BLACKHOLE_GROW, 1); - break; - case 3: - SpellTimer = urand(400,900); - NeedForAHack = 1; - if (Unit* Temp = me->getVictim()) - { - if (Temp->GetPositionZ() > 73 && Victim) + Unit* Victim = Unit::GetUnit(*me, pInstance ? pInstance->GetData64(DATA_PLAYER_GUID) : 0); + switch (NeedForAHack) + { + case 0: + me->clearUnitState(UNIT_STAT_STUNNED); + DoCastAOE(SPELL_BLACKHOLE_GROW, false); + if (Victim) AttackStart(Victim); - } else - return; - } - } else SpellTimer -= diff; + SpellTimer = 700; + NeedForAHack = 2; + break; + case 1: + me->AddAura(SPELL_BLACKHOLE_GROW, me); + NeedForAHack = 2; + SpellTimer = 600; + break; + case 2: + SpellTimer = 400; + NeedForAHack = 3; + me->RemoveAura(SPELL_BLACKHOLE_GROW, 1); + break; + case 3: + SpellTimer = urand(400,900); + NeedForAHack = 1; + if (Unit* Temp = me->getVictim()) + { + if (Temp->GetPositionZ() > 73 && Victim) + AttackStart(Victim); + } else + return; + } + } else SpellTimer -= diff; + + if (DespawnTimer <= diff) + me->DisappearAndDie(); + else DespawnTimer -= diff; + } + }; - if (DespawnTimer <= diff) - me->DisappearAndDie(); - else DespawnTimer -= diff; - } }; -CreatureAI* GetAI_npc_blackhole(Creature* pCreature) -{ - return new npc_blackholeAI (pCreature); -} void AddSC_boss_muru() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_muru"; - newscript->GetAI = &GetAI_boss_muru; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_entropius"; - newscript->GetAI = &GetAI_boss_entropius; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_muru_portal"; - newscript->GetAI = &GetAI_npc_muru_portal; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_dark_fiend"; - newscript->GetAI = &GetAI_npc_dark_fiend; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_void_sentinel"; - newscript->GetAI = &GetAI_npc_void_sentinel; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_blackhole"; - newscript->GetAI = &GetAI_npc_blackhole; - newscript->RegisterSelf(); + new boss_muru(); + new boss_entropius(); + new npc_muru_portal(); + new npc_dark_fiend(); + new npc_void_sentinel(); + new npc_blackhole(); } diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/instance_sunwell_plateau.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/instance_sunwell_plateau.cpp index 12a0bdfffff..32237b39def 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/instance_sunwell_plateau.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/instance_sunwell_plateau.cpp @@ -36,276 +36,277 @@ EndScriptData */ 4 - M'uru 5 - Kil'Jaeden */ - -struct instance_sunwell_plateau : public ScriptedInstance +
class instance_sunwell_plateau : public InstanceMapScript { - instance_sunwell_plateau(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; +public: + instance_sunwell_plateau() : InstanceMapScript("instance_sunwell_plateau") { } - uint32 m_auiEncounter[MAX_ENCOUNTER]; + InstanceScript* GetInstanceData_InstanceMapScript(Map* pMap) + { + return new instance_sunwell_plateau_InstanceMapScript(pMap); + } - /** Creatures **/ - uint64 Kalecgos_Dragon; - uint64 Kalecgos_Human; - uint64 Sathrovarr; - uint64 Brutallus; - uint64 Madrigosa; - uint64 Felmyst; - uint64 Alythess; - uint64 Sacrolash; - uint64 Muru; - uint64 KilJaeden; - uint64 KilJaedenController; - uint64 Anveena; - uint64 KalecgosKJ; - uint32 SpectralPlayers; + struct instance_sunwell_plateau_InstanceMapScript : public InstanceScript + { + instance_sunwell_plateau_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {Initialize();}; - /** GameObjects **/ - uint64 ForceField; // Kalecgos Encounter - uint64 KalecgosWall[2]; - uint64 FireBarrier; // Felmysts Encounter - uint64 MurusGate[2]; // Murus Encounter + uint32 m_auiEncounter[MAX_ENCOUNTER]; - /*** Misc ***/ - uint32 SpectralRealmTimer; - std::vector<uint64> SpectralRealmList; + /** Creatures **/ + uint64 Kalecgos_Dragon; + uint64 Kalecgos_Human; + uint64 Sathrovarr; + uint64 Brutallus; + uint64 Madrigosa; + uint64 Felmyst; + uint64 Alythess; + uint64 Sacrolash; + uint64 Muru; + uint64 KilJaeden; + uint64 KilJaedenController; + uint64 Anveena; + uint64 KalecgosKJ; + uint32 SpectralPlayers; - void Initialize() - { - memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); + /** GameObjects **/ + uint64 ForceField; // Kalecgos Encounter + uint64 KalecgosWall[2]; + uint64 FireBarrier; // Felmysts Encounter + uint64 MurusGate[2]; // Murus Encounter - /*** Creatures ***/ - Kalecgos_Dragon = 0; - Kalecgos_Human = 0; - Sathrovarr = 0; - Brutallus = 0; - Madrigosa = 0; - Felmyst = 0; - Alythess = 0; - Sacrolash = 0; - Muru = 0; - KilJaeden = 0; - KilJaedenController = 0; - Anveena = 0; - KalecgosKJ = 0; - SpectralPlayers = 0; + /*** Misc ***/ + uint32 SpectralRealmTimer; + std::vector<uint64> SpectralRealmList; - /*** GameObjects ***/ - ForceField = 0; - FireBarrier = 0; - MurusGate[0] = 0; - MurusGate[1] = 0; - KalecgosWall[0] = 0; - KalecgosWall[1] = 0; + void Initialize() + { + memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - /*** Misc ***/ - SpectralRealmTimer = 5000; - } + /*** Creatures ***/ + Kalecgos_Dragon = 0; + Kalecgos_Human = 0; + Sathrovarr = 0; + Brutallus = 0; + Madrigosa = 0; + Felmyst = 0; + Alythess = 0; + Sacrolash = 0; + Muru = 0; + KilJaeden = 0; + KilJaedenController = 0; + Anveena = 0; + KalecgosKJ = 0; + SpectralPlayers = 0; - bool IsEncounterInProgress() const - { - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) - return true; + /*** GameObjects ***/ + ForceField = 0; + FireBarrier = 0; + MurusGate[0] = 0; + MurusGate[1] = 0; + KalecgosWall[0] = 0; + KalecgosWall[1] = 0; - return false; - } + /*** Misc ***/ + SpectralRealmTimer = 5000; + } - Player* GetPlayerInMap() - { - Map::PlayerList const& players = instance->GetPlayers(); + bool IsEncounterInProgress() const + { + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + if (m_auiEncounter[i] == IN_PROGRESS) + return true; + + return false; + } - 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()) { - Player* plr = itr->getSource(); - if (plr && !plr->HasAura(45839,0)) - return plr; + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + { + Player* plr = itr->getSource(); + if (plr && !plr->HasAura(45839,0)) + return plr; + } } - } - sLog.outDebug("TSCR: Instance Sunwell Plateau: GetPlayerInMap, but PlayerList is empty!"); - return NULL; - } + sLog.outDebug("TSCR: Instance Sunwell Plateau: GetPlayerInMap, but PlayerList is empty!"); + return NULL; + } - void OnCreatureCreate(Creature* pCreature, bool /*add*/) - { - switch(pCreature->GetEntry()) + void OnCreatureCreate(Creature* pCreature, bool /*add*/) { - case 24850: Kalecgos_Dragon = pCreature->GetGUID(); break; - case 24891: Kalecgos_Human = pCreature->GetGUID(); break; - case 24892: Sathrovarr = pCreature->GetGUID(); break; - case 24882: Brutallus = pCreature->GetGUID(); break; - case 24895: Madrigosa = pCreature->GetGUID(); break; - case 25038: Felmyst = pCreature->GetGUID(); break; - case 25166: Alythess = pCreature->GetGUID(); break; - case 25165: Sacrolash = pCreature->GetGUID(); break; - case 25741: Muru = pCreature->GetGUID(); break; - case 25315: KilJaeden = pCreature->GetGUID(); break; - case 25608: KilJaedenController = pCreature->GetGUID(); break; - case 26046: Anveena = pCreature->GetGUID(); break; - case 25319: KalecgosKJ = pCreature->GetGUID(); break; + switch(pCreature->GetEntry()) + { + case 24850: Kalecgos_Dragon = pCreature->GetGUID(); break; + case 24891: Kalecgos_Human = pCreature->GetGUID(); break; + case 24892: Sathrovarr = pCreature->GetGUID(); break; + case 24882: Brutallus = pCreature->GetGUID(); break; + case 24895: Madrigosa = pCreature->GetGUID(); break; + case 25038: Felmyst = pCreature->GetGUID(); break; + case 25166: Alythess = pCreature->GetGUID(); break; + case 25165: Sacrolash = pCreature->GetGUID(); break; + case 25741: Muru = pCreature->GetGUID(); break; + case 25315: KilJaeden = pCreature->GetGUID(); break; + case 25608: KilJaedenController = pCreature->GetGUID(); break; + case 26046: Anveena = pCreature->GetGUID(); break; + case 25319: KalecgosKJ = pCreature->GetGUID(); break; + } } - } - void OnGameObjectCreate(GameObject* pGo, bool /*add*/) - { - switch(pGo->GetEntry()) + void OnGameObjectCreate(GameObject* pGo, bool /*add*/) { - case 188421: ForceField = pGo->GetGUID(); break; - case 188523: KalecgosWall[0] = pGo->GetGUID(); break; - case 188524: KalecgosWall[0] = pGo->GetGUID(); break; - case 188075: - if (m_auiEncounter[2] == DONE) - HandleGameObject(NULL, true, pGo); - FireBarrier = pGo->GetGUID(); - break; - case 187990: MurusGate[0] = pGo->GetGUID(); break; - case 188118: - if (m_auiEncounter[4] == DONE) - HandleGameObject(NULL, true, pGo); - MurusGate[1]= pGo->GetGUID(); - break; + switch(pGo->GetEntry()) + { + case 188421: ForceField = pGo->GetGUID(); break; + case 188523: KalecgosWall[0] = pGo->GetGUID(); break; + case 188524: KalecgosWall[0] = pGo->GetGUID(); break; + case 188075: + if (m_auiEncounter[2] == DONE) + HandleGameObject(NULL, true, pGo); + FireBarrier = pGo->GetGUID(); + break; + case 187990: MurusGate[0] = pGo->GetGUID(); break; + case 188118: + if (m_auiEncounter[4] == DONE) + HandleGameObject(NULL, true, pGo); + MurusGate[1]= pGo->GetGUID(); + break; + } } - } - uint32 GetData(uint32 id) - { - switch(id) + uint32 GetData(uint32 id) { - case DATA_KALECGOS_EVENT: return m_auiEncounter[0]; - case DATA_BRUTALLUS_EVENT: return m_auiEncounter[1]; - case DATA_FELMYST_EVENT: return m_auiEncounter[2]; - case DATA_EREDAR_TWINS_EVENT: return m_auiEncounter[3]; - case DATA_MURU_EVENT: return m_auiEncounter[4]; - case DATA_KILJAEDEN_EVENT: return m_auiEncounter[5]; + switch(id) + { + case DATA_KALECGOS_EVENT: return m_auiEncounter[0]; + case DATA_BRUTALLUS_EVENT: return m_auiEncounter[1]; + case DATA_FELMYST_EVENT: return m_auiEncounter[2]; + case DATA_EREDAR_TWINS_EVENT: return m_auiEncounter[3]; + case DATA_MURU_EVENT: return m_auiEncounter[4]; + case DATA_KILJAEDEN_EVENT: return m_auiEncounter[5]; + } + return 0; } - return 0; - } - uint64 GetData64(uint32 id) - { - switch(id) + uint64 GetData64(uint32 id) { - case DATA_KALECGOS_DRAGON: return Kalecgos_Dragon; - case DATA_KALECGOS_HUMAN: return Kalecgos_Human; - case DATA_SATHROVARR: return Sathrovarr; - case DATA_GO_FORCEFIELD: return ForceField; - case DATA_BRUTALLUS: return Brutallus; - case DATA_MADRIGOSA: return Madrigosa; - case DATA_FELMYST: return Felmyst; - case DATA_ALYTHESS: return Alythess; - case DATA_SACROLASH: return Sacrolash; - case DATA_MURU: return Muru; - case DATA_KILJAEDEN: return KilJaeden; - case DATA_KILJAEDEN_CONTROLLER: return KilJaedenController; - case DATA_ANVEENA: return Anveena; - case DATA_KALECGOS_KJ: return KalecgosKJ; - case DATA_PLAYER_GUID: - Player* Target = GetPlayerInMap(); - return Target->GetGUID(); + switch(id) + { + case DATA_KALECGOS_DRAGON: return Kalecgos_Dragon; + case DATA_KALECGOS_HUMAN: return Kalecgos_Human; + case DATA_SATHROVARR: return Sathrovarr; + case DATA_GO_FORCEFIELD: return ForceField; + case DATA_BRUTALLUS: return Brutallus; + case DATA_MADRIGOSA: return Madrigosa; + case DATA_FELMYST: return Felmyst; + case DATA_ALYTHESS: return Alythess; + case DATA_SACROLASH: return Sacrolash; + case DATA_MURU: return Muru; + case DATA_KILJAEDEN: return KilJaeden; + case DATA_KILJAEDEN_CONTROLLER: return KilJaedenController; + case DATA_ANVEENA: return Anveena; + case DATA_KALECGOS_KJ: return KalecgosKJ; + case DATA_PLAYER_GUID: + Player* Target = GetPlayerInMap(); + return Target->GetGUID(); + } + return 0; } - return 0; - } - void SetData(uint32 id, uint32 data) - { - switch(id) + void SetData(uint32 id, uint32 data) { - case DATA_KALECGOS_EVENT: - { - if (data == NOT_STARTED || data == DONE) + switch(id) + { + case DATA_KALECGOS_EVENT: { - HandleGameObject(ForceField,true); - HandleGameObject(KalecgosWall[0],true); - HandleGameObject(KalecgosWall[1],true); + if (data == NOT_STARTED || data == DONE) + { + HandleGameObject(ForceField,true); + HandleGameObject(KalecgosWall[0],true); + HandleGameObject(KalecgosWall[1],true); + } + else if (data == IN_PROGRESS) + { + HandleGameObject(ForceField,false); + HandleGameObject(KalecgosWall[0],false); + HandleGameObject(KalecgosWall[1],false); + } + m_auiEncounter[0] = data; } - else if (data == IN_PROGRESS) + break; + case DATA_BRUTALLUS_EVENT: m_auiEncounter[1] = data; break; + case DATA_FELMYST_EVENT: + if (data == DONE) + HandleGameObject(FireBarrier, true); + m_auiEncounter[2] = data; break; + case DATA_EREDAR_TWINS_EVENT: m_auiEncounter[3] = data; break; + case DATA_MURU_EVENT: + switch(data) { - HandleGameObject(ForceField,false); - HandleGameObject(KalecgosWall[0],false); - HandleGameObject(KalecgosWall[1],false); + case DONE: + HandleGameObject(MurusGate[0], true); + HandleGameObject(MurusGate[1], true); + break; + case IN_PROGRESS: + HandleGameObject(MurusGate[0], false); + HandleGameObject(MurusGate[1], false); + break; + case NOT_STARTED: + HandleGameObject(MurusGate[0], true); + HandleGameObject(MurusGate[1], false); + break; } - m_auiEncounter[0] = data; - } - break; - case DATA_BRUTALLUS_EVENT: m_auiEncounter[1] = data; break; - case DATA_FELMYST_EVENT: - if (data == DONE) - HandleGameObject(FireBarrier, true); - m_auiEncounter[2] = data; break; - case DATA_EREDAR_TWINS_EVENT: m_auiEncounter[3] = data; break; - case DATA_MURU_EVENT: - switch(data) - { - case DONE: - HandleGameObject(MurusGate[0], true); - HandleGameObject(MurusGate[1], true); - break; - case IN_PROGRESS: - HandleGameObject(MurusGate[0], false); - HandleGameObject(MurusGate[1], false); - break; - case NOT_STARTED: - HandleGameObject(MurusGate[0], true); - HandleGameObject(MurusGate[1], false); - break; - } - m_auiEncounter[4] = data; break; - case DATA_KILJAEDEN_EVENT: m_auiEncounter[5] = data; break; - } + m_auiEncounter[4] = data; break; + case DATA_KILJAEDEN_EVENT: m_auiEncounter[5] = data; break; + } - if (data == DONE) - SaveToDB(); - } + if (data == DONE) + SaveToDB(); + } - std::string GetSaveData() - { - OUT_SAVE_INST_DATA; - std::ostringstream stream; - stream << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " << m_auiEncounter[2] << " " << m_auiEncounter[3] << " " - << m_auiEncounter[4] << " " << m_auiEncounter[5]; - char* out = new char[stream.str().length() + 1]; - strcpy(out, stream.str().c_str()); - if (out) + std::string GetSaveData() { - OUT_SAVE_INST_DATA_COMPLETE; - return out; + OUT_SAVE_INST_DATA; + std::ostringstream stream; + stream << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " << m_auiEncounter[2] << " " << m_auiEncounter[3] << " " + << m_auiEncounter[4] << " " << m_auiEncounter[5]; + char* out = new char[stream.str().length() + 1]; + strcpy(out, stream.str().c_str()); + if (out) + { + OUT_SAVE_INST_DATA_COMPLETE; + return out; + } + return NULL; } - return NULL; - } - 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 stream(in); + stream >> m_auiEncounter[0] >> m_auiEncounter[1] >> m_auiEncounter[2] >> m_auiEncounter[3] + >> m_auiEncounter[4] >> m_auiEncounter[5]; + 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 stream(in); - stream >> m_auiEncounter[0] >> m_auiEncounter[1] >> m_auiEncounter[2] >> m_auiEncounter[3] - >> m_auiEncounter[4] >> m_auiEncounter[5]; - 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_sunwell_plateau(Map* pMap) -{ - return new instance_sunwell_plateau(pMap); -} void AddSC_instance_sunwell_plateau() { - Script *newscript; - - newscript = new Script; - newscript->Name = "instance_sunwell_plateau"; - newscript->GetInstanceData = &GetInstanceData_instance_sunwell_plateau; - newscript->RegisterSelf(); + new instance_sunwell_plateau(); } - diff --git a/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp b/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp index c470eba6648..8fa378037f7 100644 --- a/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp +++ b/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp @@ -64,7 +64,7 @@ class boss_archaedas : public CreatureScript { boss_archaedasAI(Creature *c) : ScriptedAI(c) { - pInstance = me->GetInstanceData(); + pInstance = me->GetInstanceScript(); } uint32 Tremor_Timer; @@ -74,7 +74,7 @@ class boss_archaedas : public CreatureScript bool guardiansAwake; bool vaultWalkersAwake; - ScriptedInstance* pInstance; + InstanceScript* pInstance; void Reset() { @@ -226,7 +226,7 @@ class mob_archaedas_minions : public CreatureScript { mob_archaedas_minionsAI(Creature *c) : ScriptedAI(c) { - pInstance = me->GetInstanceData(); + pInstance = me->GetInstanceScript(); } uint32 Arcing_Timer; @@ -234,7 +234,7 @@ class mob_archaedas_minions : public CreatureScript bool wakingUp; bool amIAwake; - ScriptedInstance* pInstance; + InstanceScript* pInstance; void Reset() { @@ -322,10 +322,10 @@ class mob_stonekeepers : public CreatureScript { mob_stonekeepersAI(Creature *c) : ScriptedAI(c) { - pInstance = (me->GetInstanceData()); + pInstance = (me->GetInstanceScript()); } - ScriptedInstance* pInstance; + InstanceScript* pInstance; void Reset() { @@ -385,7 +385,7 @@ class go_altar_of_archaedas : public GameObjectScript bool OnGossipHello(Player* pPlayer, GameObject* /*pGo*/) { - ScriptedInstance* pInstance = pPlayer->GetInstanceData(); + InstanceScript* pInstance = pPlayer->GetInstanceScript(); if (!pInstance) return false; @@ -417,7 +417,7 @@ class go_altar_of_the_keepers : public GameObjectScript bool OnGossipHello(Player* pPlayer, GameObject* /*pGo*/) { - ScriptedInstance* pInstance = pPlayer->GetInstanceData(); + InstanceScript* pInstance = pPlayer->GetInstanceScript(); if (!pInstance) return false; diff --git a/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp b/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp index ddd4c52f438..99f7cd56eae 100644 --- a/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp +++ b/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp @@ -33,9 +33,9 @@ class instance_uldaman : public InstanceMapScript { } - struct instance_uldaman_InstanceMapScript : public ScriptedInstance + struct instance_uldaman_InstanceMapScript : public InstanceScript { - instance_uldaman_InstanceMapScript(Map* pMap) : ScriptedInstance(pMap) + instance_uldaman_InstanceMapScript(Map* pMap) : InstanceScript(pMap) { Initialize(); }; @@ -290,7 +290,7 @@ class instance_uldaman : public InstanceMapScript } // end GetData64 }; - InstanceData* OnGetInstanceData(InstanceMap* pMap) + InstanceScript* OnGetInstanceData(InstanceMap* pMap) { return new instance_uldaman_InstanceMapScript(pMap); } diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp index 6f048557858..ed0d0fd5ba3 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp @@ -29,15 +29,18 @@ EndScriptData */ #include "zulaman.h" #include "Weather.h" -#define SPELL_STATIC_DISRUPTION 43622 -#define SPELL_STATIC_VISUAL 45265 -#define SPELL_CALL_LIGHTNING 43661 //Missing timer -#define SPELL_GUST_OF_WIND 43621 -#define SPELL_ELECTRICAL_STORM 43648 -#define SPELL_BERSERK 45078 -#define SPELL_ELECTRICAL_DAMAGE 43657 -#define SPELL_ELECTRICAL_OVERLOAD 43658 -#define SPELL_EAGLE_SWOOP 44732 +enum Spells +{ + SPELL_STATIC_DISRUPTION = 43622, + SPELL_STATIC_VISUAL = 45265, + SPELL_CALL_LIGHTNING = 43661, //Missing timer + SPELL_GUST_OF_WIND = 43621, + SPELL_ELECTRICAL_STORM = 43648, + SPELL_BERSERK = 45078, + SPELL_ELECTRICAL_DAMAGE = 43657, + SPELL_ELECTRICAL_OVERLOAD = 43658, + SPELL_EAGLE_SWOOP = 44732 +}; //"Your death gonna be quick, strangers. You shoulda never have come to this place..." #define SAY_ONAGGRO "I be da predator! You da prey..." @@ -75,9 +78,9 @@ class boss_akilzon : public CreatureScript SpellEntry *TempSpell = GET_SPELL(SPELL_ELECTRICAL_DAMAGE); if (TempSpell) TempSpell->EffectBasePoints[1] = 49;//disable bugged lightning until fixed in core - pInstance = c->GetInstanceData(); + pInstance = c->GetInstanceScript(); } - ScriptedInstance *pInstance; + InstanceScript *pInstance; uint64 BirdGUIDs[8]; uint64 TargetGUID; diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp index 08896c91b1b..5b43bbbfd10 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp @@ -86,14 +86,14 @@ class boss_halazzi : public CreatureScript { boss_halazziAI(Creature *c) : ScriptedAI(c) { - pInstance = c->GetInstanceData(); + pInstance = c->GetInstanceScript(); // need to find out what controls totem's spell cooldown SpellEntry *TempSpell = GET_SPELL(SPELL_LIGHTNING); if (TempSpell && TempSpell->CastingTimeIndex != 5) TempSpell->CastingTimeIndex = 5; // 2000 ms casting time } - ScriptedInstance *pInstance; + InstanceScript *pInstance; uint32 FrenzyTimer; uint32 SaberlashTimer; diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp index b968f89ae8e..0b026ce826d 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp @@ -177,11 +177,11 @@ static PlayerAbilityStruct PlayerAbility[][3] = struct boss_hexlord_addAI : public ScriptedAI { - ScriptedInstance* pInstance; + InstanceScript* pInstance; boss_hexlord_addAI(Creature* c) : ScriptedAI(c) { - pInstance = c->GetInstanceData(); + pInstance = c->GetInstanceScript(); } void Reset() {} @@ -213,13 +213,13 @@ class boss_hexlord_malacrass : public CreatureScript { boss_hex_lord_malacrassAI(Creature *c) : ScriptedAI(c) { - pInstance = c->GetInstanceData(); + pInstance = c->GetInstanceScript(); SelectAddEntry(); for (uint8 i = 0; i < 4; ++i) AddGUID[i] = 0; } - ScriptedInstance *pInstance; + InstanceScript *pInstance; uint64 AddGUID[4]; uint32 AddEntry[4]; @@ -469,7 +469,7 @@ class boss_hexlord_malacrass : public CreatureScript CreatureAI* GetAI(Creature* creature) const { - return new boss_hexlord_malacrassAI(creature); + return new boss_hex_lord_malacrassAI(creature); } }; @@ -937,7 +937,7 @@ void AddSC_boss_hex_lord_malacrass() { new boss_hexlord_malacrass(); new boss_thurg(); - new boss_gazakroth(); + // new boss_gazakroth(); new boss_lord_raadan(); new boss_darkheart(); new boss_slither(); diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp index a7e020c2e66..3604a5d3678 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp @@ -114,7 +114,7 @@ class boss_janalai : public CreatureScript { boss_janalaiAI(Creature *c) : ScriptedAI(c) { - pInstance =c->GetInstanceData(); + pInstance =c->GetInstanceScript(); SpellEntry *TempSpell = GET_SPELL(SPELL_HATCH_EGG); if (TempSpell && TempSpell->EffectImplicitTargetA[0] != 1) @@ -124,7 +124,7 @@ class boss_janalai : public CreatureScript } } - ScriptedInstance *pInstance; + InstanceScript *pInstance; uint32 FireBreathTimer; uint32 BombTimer; @@ -493,12 +493,12 @@ class mob_janalai_hatcher : public CreatureScript struct mob_janalai_hatcherAI : public ScriptedAI { - mob_amanishi_hatcherAI(Creature *c) : ScriptedAI(c) + mob_janalai_hatcherAI(Creature *c) : ScriptedAI(c) { - pInstance =c->GetInstanceData(); + pInstance =c->GetInstanceScript(); } - ScriptedInstance *pInstance; + InstanceScript *pInstance; uint32 waypoint; uint32 HatchNum; @@ -628,10 +628,10 @@ class mob_janalai_hatchling : public CreatureScript { mob_janalai_hatchlingAI(Creature *c) : ScriptedAI(c) { - pInstance =c->GetInstanceData(); + pInstance =c->GetInstanceScript(); } - ScriptedInstance *pInstance; + InstanceScript *pInstance; uint32 BuffetTimer; void Reset() @@ -676,38 +676,37 @@ class mob_janalai_hatchling : public CreatureScript class mob_janalai_egg : public CreatureScript { - public: +public: - mob_janalai_egg() - : CreatureScript("mob_janalai_egg") - { - } - - + mob_janalai_egg() + : CreatureScript("mob_janalai_egg") + { + } - CreatureAI* GetAI(Creature* creature) const - { - return new mob_janalai_eggAI(creature); - } -}; + CreatureAI* GetAI(Creature* creature) const + { + return new mob_janalai_eggAI(creature); + } -struct mob_eggAI : public ScriptedAI -{ - mob_eggAI(Creature *c) : ScriptedAI(c){} - void Reset() {} - void EnterCombat(Unit* /*who*/) {} - void AttackStart(Unit* /*who*/) {} - void MoveInLineOfSight(Unit* /*who*/) {} - void UpdateAI(const uint32 /*diff*/) {} - - void SpellHit(Unit * /*caster*/, const SpellEntry *spell) + struct mob_janalai_eggAI : public ScriptedAI { - if (spell->Id == SPELL_HATCH_EGG) + mob_janalai_eggAI(Creature *c) : ScriptedAI(c){} + void Reset() {} + void EnterCombat(Unit* /*who*/) {} + void AttackStart(Unit* /*who*/) {} + void MoveInLineOfSight(Unit* /*who*/) {} + void UpdateAI(const uint32 /*diff*/) {} + + void SpellHit(Unit * /*caster*/, const SpellEntry *spell) { - DoSpawnCreature(MOB_HATCHLING, 0, 0, 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 60000); - me->SetDisplayId(11686); + if (spell->Id == SPELL_HATCH_EGG) + { + DoSpawnCreature(MOB_HATCHLING, 0, 0, 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 60000); + me->SetDisplayId(11686); + } } - } + }; + }; void AddSC_boss_janalai() diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp index d1e8912f18e..6bcc5553e1d 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp @@ -105,10 +105,10 @@ class boss_nalorakk : public CreatureScript { MoveEvent = true; MovePhase = 0; - pInstance = c->GetInstanceData(); + pInstance = c->GetInstanceScript(); } - ScriptedInstance *pInstance; + InstanceScript *pInstance; uint32 BrutalSwipe_Timer; uint32 Mangle_Timer; diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp index 6f442afa064..40eb40f6fcf 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp @@ -153,9 +153,9 @@ class boss_zuljin : public CreatureScript { boss_zuljinAI(Creature *c) : ScriptedAI(c), Summons(me) { - pInstance = c->GetInstanceData(); + pInstance = c->GetInstanceScript(); } - ScriptedInstance *pInstance; + InstanceScript *pInstance; uint64 SpiritGUID[4]; uint64 ClawTargetGUID; diff --git a/src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp b/src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp index b600ea26ad9..065f6f1ef51 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp @@ -59,9 +59,9 @@ class instance_zulaman : public InstanceMapScript { } - struct instance_zulaman_InstanceMapScript : public ScriptedInstance + struct instance_zulaman_InstanceMapScript : public InstanceScript { - instance_zulaman_InstanceMapScript(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; + instance_zulaman_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {Initialize();}; uint64 HarkorsSatchelGUID; uint64 TanzarsTrunkGUID; @@ -314,7 +314,7 @@ class instance_zulaman : public InstanceMapScript } }; - InstanceData* GetInstanceData(InstanceMap* pMap) const + InstanceScript* GetInstanceScript(InstanceMap* pMap) const { return new instance_zulaman_InstanceMapScript(pMap); } diff --git a/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp b/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp index 4a4a5e06f76..79d6ce4e3a5 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp @@ -51,10 +51,10 @@ class npc_forest_frog : public CreatureScript { npc_forest_frogAI(Creature* c) : ScriptedAI(c) { - pInstance = c->GetInstanceData(); + pInstance = c->GetInstanceScript(); } - ScriptedInstance *pInstance; + InstanceScript *pInstance; void Reset() {} @@ -166,7 +166,7 @@ class npc_zulaman_hostage : public CreatureScript return true; pCreature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - ScriptedInstance* pInstance = pCreature->GetInstanceData(); + InstanceScript* pInstance = pCreature->GetInstanceScript(); if (pInstance) { //uint8 progress = pInstance->GetData(DATA_CHESTLOOTED); diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp index d20a124f5a0..4f86318c5b6 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp @@ -61,10 +61,10 @@ class boss_arlokk : public CreatureScript { boss_arlokkAI(Creature* pCreature) : ScriptedAI(pCreature) { - m_pInstance = pCreature->GetInstanceData(); + m_pInstance = pCreature->GetInstanceScript(); } - ScriptedInstance* m_pInstance; + InstanceScript* m_pInstance; uint32 m_uiShadowWordPain_Timer; uint32 m_uiGouge_Timer; @@ -271,7 +271,7 @@ class go_gong_of_bethekk : public GameObjectScript bool OnGossipHello(Player* /*pPlayer*/, GameObject* pGo) { - if (ScriptedInstance* m_pInstance = pGo->GetInstanceData()) + if (InstanceScript* m_pInstance = pGo->GetInstanceScript()) { if (m_pInstance->GetData(TYPE_ARLOKK) == DONE || m_pInstance->GetData(TYPE_ARLOKK) == IN_PROGRESS) return true; diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_hakkar.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_hakkar.cpp index 680a68f773a..5d226bca91b 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_hakkar.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_hakkar.cpp @@ -57,10 +57,10 @@ class boss_hakkar : public CreatureScript { boss_hakkarAI(Creature *c) : ScriptedAI(c) { - m_pInstance = c->GetInstanceData(); + m_pInstance = c->GetInstanceScript(); } - ScriptedInstance *m_pInstance; + InstanceScript *m_pInstance; uint32 BloodSiphon_Timer; uint32 CorruptedBlood_Timer; diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_jeklik.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_jeklik.cpp index 34340ba7896..c9d20db0380 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_jeklik.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_jeklik.cpp @@ -56,10 +56,10 @@ class boss_jeklik : public CreatureScript { boss_jeklikAI(Creature *c) : ScriptedAI(c) { - m_pInstance = c->GetInstanceData(); + m_pInstance = c->GetInstanceScript(); } - ScriptedInstance *m_pInstance; + InstanceScript *m_pInstance; uint32 Charge_Timer; uint32 SonicBurst_Timer; @@ -238,10 +238,10 @@ class mob_batrider : public CreatureScript { mob_batriderAI(Creature *c) : ScriptedAI(c) { - m_pInstance = c->GetInstanceData(); + m_pInstance = c->GetInstanceScript(); } - ScriptedInstance *m_pInstance; + InstanceScript *m_pInstance; uint32 Bomb_Timer; uint32 Check_Timer; diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_jindo.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_jindo.cpp index 689cc4dae27..d98fbf0f559 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_jindo.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_jindo.cpp @@ -189,12 +189,12 @@ class mob_healing_ward : public CreatureScript { mob_healing_wardAI(Creature *c) : ScriptedAI(c) { - pInstance = c->GetInstanceData(); + pInstance = c->GetInstanceScript(); } uint32 Heal_Timer; - ScriptedInstance *pInstance; + InstanceScript *pInstance; void Reset() { diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp index 3c8ab2fdf23..90adeb5743a 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp @@ -57,7 +57,7 @@ class boss_mandokir : public CreatureScript { boss_mandokirAI(Creature *c) : ScriptedAI(c) { - m_pInstance = c->GetInstanceData(); + m_pInstance = c->GetInstanceScript(); } uint32 KillCount; @@ -72,7 +72,7 @@ class boss_mandokir : public CreatureScript float targetY; float targetZ; - ScriptedInstance *m_pInstance; + InstanceScript *m_pInstance; bool endWatch; bool someWatched; @@ -296,11 +296,11 @@ class mob_ohgan : public CreatureScript { mob_ohganAI(Creature *c) : ScriptedAI(c) { - m_pInstance = c->GetInstanceData(); + m_pInstance = c->GetInstanceScript(); } uint32 SunderArmor_Timer; - ScriptedInstance *m_pInstance; + InstanceScript *m_pInstance; void Reset() { diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_marli.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_marli.cpp index 644ccc6788a..0963057f299 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_marli.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_marli.cpp @@ -53,10 +53,10 @@ class boss_marli : public CreatureScript { boss_marliAI(Creature *c) : ScriptedAI(c) { - m_pInstance = c->GetInstanceData(); + m_pInstance = c->GetInstanceScript(); } - ScriptedInstance *m_pInstance; + InstanceScript *m_pInstance; uint32 SpawnStartSpiders_Timer; uint32 PoisonVolley_Timer; @@ -211,11 +211,10 @@ class boss_marli : public CreatureScript } } }; - CreatureAI* GetAI(Creature* creature) const { - return new example_creatureAI(creature); + return new boss_marliAI(creature); } }; diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_thekal.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_thekal.cpp index d4bbf4704ca..99392a6c7ce 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_thekal.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_thekal.cpp @@ -68,7 +68,7 @@ class boss_thekal : public CreatureScript { boss_thekalAI(Creature *c) : ScriptedAI(c) { - m_pInstance = c->GetInstanceData(); + m_pInstance = c->GetInstanceScript(); } uint32 MortalCleave_Timer; @@ -81,7 +81,7 @@ class boss_thekal : public CreatureScript uint32 Check_Timer; uint32 Resurrect_Timer; - ScriptedInstance *m_pInstance; + InstanceScript *m_pInstance; bool Enraged; bool PhaseTwo; bool WasDead; @@ -276,7 +276,7 @@ class mob_zealot_lorkhan : public CreatureScript { mob_zealot_lorkhanAI(Creature *c) : ScriptedAI(c) { - m_pInstance = c->GetInstanceData(); + m_pInstance = c->GetInstanceScript(); } uint32 Shield_Timer; @@ -287,7 +287,7 @@ class mob_zealot_lorkhan : public CreatureScript bool FakeDeath; - ScriptedInstance *m_pInstance; + InstanceScript *m_pInstance; void Reset() { @@ -433,7 +433,7 @@ class mob_zealot_zath : public CreatureScript { mob_zealot_zathAI(Creature *c) : ScriptedAI(c) { - m_pInstance = c->GetInstanceData(); + m_pInstance = c->GetInstanceScript(); } uint32 SweepingStrikes_Timer; @@ -445,7 +445,7 @@ class mob_zealot_zath : public CreatureScript bool FakeDeath; - ScriptedInstance *m_pInstance; + InstanceScript *m_pInstance; void Reset() { diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_venoxis.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_venoxis.cpp index b3530fb1a29..b0172c041a4 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_venoxis.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_venoxis.cpp @@ -52,10 +52,10 @@ class boss_venoxis : public CreatureScript { boss_venoxisAI(Creature *c) : ScriptedAI(c) { - m_pInstance = c->GetInstanceData(); + m_pInstance = c->GetInstanceScript(); } - ScriptedInstance *m_pInstance; + InstanceScript *m_pInstance; uint32 HolyFire_Timer; uint32 HolyWrath_Timer; diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/instance_zulgurub.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/instance_zulgurub.cpp index 6649ea66528..4f496a72c6c 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/instance_zulgurub.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/instance_zulgurub.cpp @@ -34,9 +34,9 @@ class instance_zulgurub : public InstanceMapScript { } - struct instance_zulgurub_InstanceMapScript : public ScriptedInstance + struct instance_zulgurub_InstanceMapScript : public InstanceScript { - instance_zulgurub(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; + instance_zulgurub_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {Initialize();}; //If all High Priest bosses were killed. Lorkhan, Zath and Ohgan are added too. uint32 m_auiEncounter[MAX_ENCOUNTERS]; @@ -153,7 +153,7 @@ class instance_zulgurub : public InstanceMapScript } }; - InstanceData* OnGetInstanceData(InstanceMap* pMap) + InstanceScript* OnGetInstanceData(InstanceMap* pMap) { return new instance_zulgurub_InstanceMapScript(pMap); } diff --git a/src/server/scripts/EasternKingdoms/blasted_lands.cpp b/src/server/scripts/EasternKingdoms/blasted_lands.cpp index cbeb8d45ffe..5f0cdcbf892 100644 --- a/src/server/scripts/EasternKingdoms/blasted_lands.cpp +++ b/src/server/scripts/EasternKingdoms/blasted_lands.cpp @@ -39,27 +39,34 @@ EndContentData */ #define SPELL_TELEPORT_SINGLE 12885 #define SPELL_TELEPORT_SINGLE_IN_GROUP 13142 #define SPELL_TELEPORT_GROUP 27686 - -bool GossipHello_npc_deathly_usher(Player* pPlayer, Creature* pCreature) +
class npc_deathly_usher : public CreatureScript { - if (pPlayer->GetQuestStatus(3628) == QUEST_STATUS_INCOMPLETE && pPlayer->HasItemCount(10757, 1)) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_USHER, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); +public: + npc_deathly_usher() : CreatureScript("npc_deathly_usher") { } - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) + { + if (uiAction == GOSSIP_ACTION_INFO_DEF) + { + pPlayer->CLOSE_GOSSIP_MENU(); + pCreature->CastSpell(pPlayer, SPELL_TELEPORT_SINGLE, true); + } - return true; -} + return true; + } -bool GossipSelect_npc_deathly_usher(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF) + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - pPlayer->CLOSE_GOSSIP_MENU(); - pCreature->CastSpell(pPlayer, SPELL_TELEPORT_SINGLE, true); + if (pPlayer->GetQuestStatus(3628) == QUEST_STATUS_INCOMPLETE && pPlayer->HasItemCount(10757, 1)) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_USHER, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); + + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + + return true; } - return true; -} +}; + /*###### ## npc_fallen_hero_of_horde @@ -74,90 +81,86 @@ bool GossipSelect_npc_deathly_usher(Player* pPlayer, Creature* pCreature, uint32 #define GOSSIP_ITEM_FALLEN3 "What are the stones of binding?" #define GOSSIP_ITEM_FALLEN4 "You can count on me, Hero" #define GOSSIP_ITEM_FALLEN5 "I shall" - -bool GossipHello_npc_fallen_hero_of_horde(Player* pPlayer, Creature* pCreature) +
class npc_fallen_hero_of_horde : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); +public: + npc_fallen_hero_of_horde() : CreatureScript("npc_fallen_hero_of_horde") { } + + 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_ITEM_FALLEN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 11); + pPlayer->SEND_GOSSIP_MENU(1392, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+11: + pPlayer->SEND_GOSSIP_MENU(1411, pCreature->GetGUID()); + if (pPlayer->GetQuestStatus(2784) == QUEST_STATUS_INCOMPLETE) + pPlayer->AreaExploredOrEventHappens(2784); + if (pPlayer->GetTeam() == ALLIANCE) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_FALLEN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + pPlayer->SEND_GOSSIP_MENU(1411, pCreature->GetGUID()); + } + break; + + case GOSSIP_ACTION_INFO_DEF+2: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_FALLEN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 21); + pPlayer->SEND_GOSSIP_MENU(1451, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+21: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_FALLEN1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 22); + pPlayer->SEND_GOSSIP_MENU(1452, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+22: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_FALLEN2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 23); + pPlayer->SEND_GOSSIP_MENU(1453, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+23: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_FALLEN3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 24); + pPlayer->SEND_GOSSIP_MENU(1454, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+24: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_FALLEN4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 25); + pPlayer->SEND_GOSSIP_MENU(1455, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+25: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_FALLEN5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 26); + pPlayer->SEND_GOSSIP_MENU(1456, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+26: + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->AreaExploredOrEventHappens(2801); + break; + } + return true; + } - if (pPlayer->GetQuestStatus(2784) == QUEST_STATUS_INCOMPLETE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_H_F1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if (pPlayer->GetQuestStatus(2801) == QUEST_STATUS_INCOMPLETE && pPlayer->GetTeam() == HORDE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_H_F2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); + if (pPlayer->GetQuestStatus(2784) == QUEST_STATUS_INCOMPLETE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_H_F1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - if (pPlayer->GetQuestStatus(2801) == QUEST_STATUS_INCOMPLETE && pPlayer->GetTeam() == ALLIANCE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_H_F1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + if (pPlayer->GetQuestStatus(2801) == QUEST_STATUS_INCOMPLETE && pPlayer->GetTeam() == HORDE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_H_F2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + if (pPlayer->GetQuestStatus(2801) == QUEST_STATUS_INCOMPLETE && pPlayer->GetTeam() == ALLIANCE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_H_F1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - return true; -} + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); -bool GossipSelect_npc_fallen_hero_of_horde(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - switch (uiAction) - { - case GOSSIP_ACTION_INFO_DEF+1: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_FALLEN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 11); - pPlayer->SEND_GOSSIP_MENU(1392, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+11: - pPlayer->SEND_GOSSIP_MENU(1411, pCreature->GetGUID()); - if (pPlayer->GetQuestStatus(2784) == QUEST_STATUS_INCOMPLETE) - pPlayer->AreaExploredOrEventHappens(2784); - if (pPlayer->GetTeam() == ALLIANCE) - { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_FALLEN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - pPlayer->SEND_GOSSIP_MENU(1411, pCreature->GetGUID()); - } - break; - - case GOSSIP_ACTION_INFO_DEF+2: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_FALLEN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 21); - pPlayer->SEND_GOSSIP_MENU(1451, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+21: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_FALLEN1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 22); - pPlayer->SEND_GOSSIP_MENU(1452, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+22: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_FALLEN2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 23); - pPlayer->SEND_GOSSIP_MENU(1453, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+23: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_FALLEN3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 24); - pPlayer->SEND_GOSSIP_MENU(1454, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+24: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_FALLEN4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 25); - pPlayer->SEND_GOSSIP_MENU(1455, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+25: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_FALLEN5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 26); - pPlayer->SEND_GOSSIP_MENU(1456, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+26: - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->AreaExploredOrEventHappens(2801); - break; + return true; } - return true; -} + +}; + void AddSC_blasted_lands() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_deathly_usher"; - newscript->pGossipHello = &GossipHello_npc_deathly_usher; - newscript->pGossipSelect = &GossipSelect_npc_deathly_usher; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_fallen_hero_of_horde"; - newscript->pGossipHello = &GossipHello_npc_fallen_hero_of_horde; - newscript->pGossipSelect = &GossipSelect_npc_fallen_hero_of_horde; - newscript->RegisterSelf(); + new npc_deathly_usher(); + new npc_fallen_hero_of_horde(); } diff --git a/src/server/scripts/EasternKingdoms/boss_kruul.cpp b/src/server/scripts/EasternKingdoms/boss_kruul.cpp index d6a6cb76d59..afb0f50fd8b 100644 --- a/src/server/scripts/EasternKingdoms/boss_kruul.cpp +++ b/src/server/scripts/EasternKingdoms/boss_kruul.cpp @@ -32,125 +32,128 @@ EndScriptData */ #define SPELL_VOIDBOLT 21066 #define SPELL_RAGE 21340 #define SPELL_CAPTURESOUL 21054 - -struct boss_kruulAI : public ScriptedAI +
class boss_kruul : public CreatureScript { - boss_kruulAI(Creature *c) : ScriptedAI(c) {} - - uint32 ShadowVolley_Timer; - uint32 Cleave_Timer; - uint32 ThunderClap_Timer; - uint32 TwistedReflection_Timer; - uint32 VoidBolt_Timer; - uint32 Rage_Timer; - uint32 Hound_Timer; - - void Reset() - { - ShadowVolley_Timer = 10000; - Cleave_Timer = 14000; - ThunderClap_Timer = 20000; - TwistedReflection_Timer = 25000; - VoidBolt_Timer = 30000; - Rage_Timer = 60000; //Cast rage after 1 minute - Hound_Timer = 8000; - } - - void EnterCombat(Unit * /*who*/) - { - } +public: + boss_kruul() : CreatureScript("boss_kruul") { } - void KilledUnit() + CreatureAI* GetAI(Creature* pCreature) const { - // When a player, pet or totem gets killed, Lord Kazzak casts this spell to instantly regenerate 70,000 health. - DoCast(me, SPELL_CAPTURESOUL); + return new boss_kruulAI (pCreature); } - void SummonHounds(Unit* pVictim) + struct boss_kruulAI : public ScriptedAI { - if (Creature *Hound = DoSpawnCreature(19207, irand(-9,9), irand(-9,9), 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000)) - Hound->AI()->AttackStart(pVictim); - } + boss_kruulAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + uint32 ShadowVolley_Timer; + uint32 Cleave_Timer; + uint32 ThunderClap_Timer; + uint32 TwistedReflection_Timer; + uint32 VoidBolt_Timer; + uint32 Rage_Timer; + uint32 Hound_Timer; - //ShadowVolley_Timer - if (ShadowVolley_Timer <= diff) + void Reset() { - if (urand(0,99) < 45) - DoCast(me->getVictim(), SPELL_SHADOWVOLLEY); - - ShadowVolley_Timer = 5000; - } else ShadowVolley_Timer -= diff; - - //Cleave_Timer - if (Cleave_Timer <= diff) + ShadowVolley_Timer = 10000; + Cleave_Timer = 14000; + ThunderClap_Timer = 20000; + TwistedReflection_Timer = 25000; + VoidBolt_Timer = 30000; + Rage_Timer = 60000; //Cast rage after 1 minute + Hound_Timer = 8000; + } + + void EnterCombat(Unit * /*who*/) { - if (urand(0,1)) - DoCast(me->getVictim(), SPELL_CLEAVE); + } - Cleave_Timer = 10000; - } else Cleave_Timer -= diff; - - //ThunderClap_Timer - if (ThunderClap_Timer <= diff) - { - if (urand(0,9) < 2) - DoCast(me->getVictim(), SPELL_THUNDERCLAP); - - ThunderClap_Timer = 12000; - } else ThunderClap_Timer -= diff; - - //TwistedReflection_Timer - if (TwistedReflection_Timer <= diff) + void KilledUnit() { - DoCast(me->getVictim(), SPELL_TWISTEDREFLECTION); - TwistedReflection_Timer = 30000; - } else TwistedReflection_Timer -= diff; + // When a player, pet or totem gets killed, Lord Kazzak casts this spell to instantly regenerate 70,000 health. + DoCast(me, SPELL_CAPTURESOUL); + } - //VoidBolt_Timer - if (VoidBolt_Timer <= diff) + void SummonHounds(Unit* pVictim) { - if (urand(0,9) < 4) - DoCast(me->getVictim(), SPELL_VOIDBOLT); - - VoidBolt_Timer = 18000; - } else VoidBolt_Timer -= diff; + if (Creature *Hound = DoSpawnCreature(19207, irand(-9,9), irand(-9,9), 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000)) + Hound->AI()->AttackStart(pVictim); + } - //Rage_Timer - if (Rage_Timer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me, SPELL_RAGE); - Rage_Timer = 70000; - } else Rage_Timer -= diff; + //Return since we have no target + if (!UpdateVictim()) + return; + + //ShadowVolley_Timer + if (ShadowVolley_Timer <= diff) + { + if (urand(0,99) < 45) + DoCast(me->getVictim(), SPELL_SHADOWVOLLEY); + + ShadowVolley_Timer = 5000; + } else ShadowVolley_Timer -= diff; + + //Cleave_Timer + if (Cleave_Timer <= diff) + { + if (urand(0,1)) + DoCast(me->getVictim(), SPELL_CLEAVE); + + Cleave_Timer = 10000; + } else Cleave_Timer -= diff; + + //ThunderClap_Timer + if (ThunderClap_Timer <= diff) + { + if (urand(0,9) < 2) + DoCast(me->getVictim(), SPELL_THUNDERCLAP); + + ThunderClap_Timer = 12000; + } else ThunderClap_Timer -= diff; + + //TwistedReflection_Timer + if (TwistedReflection_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_TWISTEDREFLECTION); + TwistedReflection_Timer = 30000; + } else TwistedReflection_Timer -= diff; + + //VoidBolt_Timer + if (VoidBolt_Timer <= diff) + { + if (urand(0,9) < 4) + DoCast(me->getVictim(), SPELL_VOIDBOLT); + + VoidBolt_Timer = 18000; + } else VoidBolt_Timer -= diff; + + //Rage_Timer + if (Rage_Timer <= diff) + { + DoCast(me, SPELL_RAGE); + Rage_Timer = 70000; + } else Rage_Timer -= diff; + + //Hound_Timer + if (Hound_Timer <= diff) + { + SummonHounds(me->getVictim()); + SummonHounds(me->getVictim()); + SummonHounds(me->getVictim()); + + Hound_Timer = 45000; + } else Hound_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - //Hound_Timer - if (Hound_Timer <= diff) - { - SummonHounds(me->getVictim()); - SummonHounds(me->getVictim()); - SummonHounds(me->getVictim()); - - Hound_Timer = 45000; - } else Hound_Timer -= diff; - - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_kruul(Creature* pCreature) -{ - return new boss_kruulAI (pCreature); -} void AddSC_boss_kruul() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_kruul"; - newscript->GetAI = &GetAI_boss_kruul; - newscript->RegisterSelf(); + new boss_kruul(); } diff --git a/src/server/scripts/EasternKingdoms/burning_steppes.cpp b/src/server/scripts/EasternKingdoms/burning_steppes.cpp index de543258b40..32157a16439 100644 --- a/src/server/scripts/EasternKingdoms/burning_steppes.cpp +++ b/src/server/scripts/EasternKingdoms/burning_steppes.cpp @@ -45,111 +45,113 @@ EndContentData */ #define GOSSIP_SELECT9 "300? So the Dark Irons killed him and dragged him into the Depths?" #define GOSSIP_SELECT10 "Ahh... Ironfoe" #define GOSSIP_SELECT11 "Thanks, Ragged John. Your story was very uplifting and informative" - -struct npc_ragged_johnAI : public ScriptedAI +
class npc_ragged_john : public CreatureScript { - npc_ragged_johnAI(Creature *c) : ScriptedAI(c) {} +public: + npc_ragged_john() : CreatureScript("npc_ragged_john") { } + + 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_SELECT1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + pPlayer->SEND_GOSSIP_MENU(2714, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+1: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + pPlayer->SEND_GOSSIP_MENU(2715, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+2: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); + pPlayer->SEND_GOSSIP_MENU(2716, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+3: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4); + pPlayer->SEND_GOSSIP_MENU(2717, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+4: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5); + pPlayer->SEND_GOSSIP_MENU(2718, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+5: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT6, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 6); + pPlayer->SEND_GOSSIP_MENU(2719, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+6: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT7, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 7); + pPlayer->SEND_GOSSIP_MENU(2720, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+7: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT8, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 8); + pPlayer->SEND_GOSSIP_MENU(2721, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+8: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT9, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 9); + pPlayer->SEND_GOSSIP_MENU(2722, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+9: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT10, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 10); + pPlayer->SEND_GOSSIP_MENU(2723, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+10: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT11, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 11); + pPlayer->SEND_GOSSIP_MENU(2725, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+11: + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->AreaExploredOrEventHappens(4224); + break; + } + return true; + } + + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + + if (pPlayer->GetQuestStatus(4224) == QUEST_STATUS_INCOMPLETE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - void Reset() {} + pPlayer->SEND_GOSSIP_MENU(2713, pCreature->GetGUID()); + return true; + } - void MoveInLineOfSight(Unit *who) + CreatureAI* GetAI(Creature* pCreature) const { - if (who->HasAura(16468)) + return new npc_ragged_johnAI (pCreature); + } + + struct npc_ragged_johnAI : public ScriptedAI + { + npc_ragged_johnAI(Creature *c) : ScriptedAI(c) {} + + void Reset() {} + + void MoveInLineOfSight(Unit *who) { - if (who->GetTypeId() == TYPEID_PLAYER && me->IsWithinDistInMap(who, 15) && who->isInAccessiblePlaceFor(me)) + if (who->HasAura(16468)) { - DoCast(who, 16472); - CAST_PLR(who)->AreaExploredOrEventHappens(4866); + if (who->GetTypeId() == TYPEID_PLAYER && me->IsWithinDistInMap(who, 15) && who->isInAccessiblePlaceFor(me)) + { + DoCast(who, 16472); + CAST_PLR(who)->AreaExploredOrEventHappens(4866); + } } + + ScriptedAI::MoveInLineOfSight(who); } - ScriptedAI::MoveInLineOfSight(who); - } + void EnterCombat(Unit * /*who*/) {} + }; - void EnterCombat(Unit * /*who*/) {} }; -CreatureAI* GetAI_npc_ragged_john(Creature* pCreature) -{ - return new npc_ragged_johnAI (pCreature); -} - -bool GossipHello_npc_ragged_john(Player* pPlayer, Creature* pCreature) -{ - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if (pPlayer->GetQuestStatus(4224) == QUEST_STATUS_INCOMPLETE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - pPlayer->SEND_GOSSIP_MENU(2713, pCreature->GetGUID()); - return true; -} - -bool GossipSelect_npc_ragged_john(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - switch (uiAction) - { - case GOSSIP_ACTION_INFO_DEF: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - pPlayer->SEND_GOSSIP_MENU(2714, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+1: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - pPlayer->SEND_GOSSIP_MENU(2715, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+2: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); - pPlayer->SEND_GOSSIP_MENU(2716, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+3: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4); - pPlayer->SEND_GOSSIP_MENU(2717, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+4: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5); - pPlayer->SEND_GOSSIP_MENU(2718, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+5: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT6, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 6); - pPlayer->SEND_GOSSIP_MENU(2719, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+6: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT7, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 7); - pPlayer->SEND_GOSSIP_MENU(2720, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+7: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT8, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 8); - pPlayer->SEND_GOSSIP_MENU(2721, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+8: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT9, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 9); - pPlayer->SEND_GOSSIP_MENU(2722, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+9: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT10, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 10); - pPlayer->SEND_GOSSIP_MENU(2723, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+10: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT11, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 11); - pPlayer->SEND_GOSSIP_MENU(2725, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+11: - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->AreaExploredOrEventHappens(4224); - break; - } - return true; -} void AddSC_burning_steppes() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_ragged_john"; - newscript->GetAI = &GetAI_npc_ragged_john; - newscript->pGossipHello = &GossipHello_npc_ragged_john; - newscript->pGossipSelect = &GossipSelect_npc_ragged_john; - newscript->RegisterSelf(); + new npc_ragged_john(); } diff --git a/src/server/scripts/EasternKingdoms/dun_morogh.cpp b/src/server/scripts/EasternKingdoms/dun_morogh.cpp index c170529aa45..9b3f879df97 100644 --- a/src/server/scripts/EasternKingdoms/dun_morogh.cpp +++ b/src/server/scripts/EasternKingdoms/dun_morogh.cpp @@ -35,70 +35,72 @@ EndContentData */ // signed for 6172 #define SAY_HEAL -1100280 - -struct npc_narm_faulkAI : public ScriptedAI +
class npc_narm_faulk : public CreatureScript { - uint32 lifeTimer; - bool spellHit; - - npc_narm_faulkAI(Creature *c) : ScriptedAI(c) {} +public: + npc_narm_faulk() : CreatureScript("npc_narm_faulk") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - lifeTimer = 120000; - me->SetUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); - me->SetStandState(UNIT_STAND_STATE_DEAD); - spellHit = false; + return new npc_narm_faulkAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct npc_narm_faulkAI : public ScriptedAI { - } + uint32 lifeTimer; + bool spellHit; - void MoveInLineOfSight(Unit * /*who*/) - { - return; - } + npc_narm_faulkAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - if (me->IsStandState()) + void Reset() + { + lifeTimer = 120000; + me->SetUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); + me->SetStandState(UNIT_STAND_STATE_DEAD); + spellHit = false; + } + + void EnterCombat(Unit * /*who*/) + { + } + + void MoveInLineOfSight(Unit * /*who*/) { - if (lifeTimer <= diff) + return; + } + + void UpdateAI(const uint32 diff) + { + if (me->IsStandState()) { - EnterEvadeMode(); - return; + if (lifeTimer <= diff) + { + EnterEvadeMode(); + return; + } + else + lifeTimer -= diff; } - else - lifeTimer -= diff; } - } - void SpellHit(Unit * /*Hitter*/, const SpellEntry *Spellkind) - { - if (Spellkind->Id == 8593 && !spellHit) + void SpellHit(Unit * /*Hitter*/, const SpellEntry *Spellkind) { - DoCast(me, 32343); - me->SetStandState(UNIT_STAND_STATE_STAND); - me->SetUInt32Value(UNIT_DYNAMIC_FLAGS, 0); - //me->RemoveAllAuras(); - DoScriptText(SAY_HEAL, me); - spellHit = true; + if (Spellkind->Id == 8593 && !spellHit) + { + DoCast(me, 32343); + me->SetStandState(UNIT_STAND_STATE_STAND); + me->SetUInt32Value(UNIT_DYNAMIC_FLAGS, 0); + //me->RemoveAllAuras(); + DoScriptText(SAY_HEAL, me); + spellHit = true; + } } - } + + }; }; -CreatureAI* GetAI_npc_narm_faulk(Creature* pCreature) -{ - return new npc_narm_faulkAI (pCreature); -} void AddSC_dun_morogh() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_narm_faulk"; - newscript->GetAI = &GetAI_npc_narm_faulk; - newscript->RegisterSelf(); + new npc_narm_faulk(); } diff --git a/src/server/scripts/EasternKingdoms/duskwood.cpp b/src/server/scripts/EasternKingdoms/duskwood.cpp index 3dcf9a01f6a..f40aa0fd86f 100644 --- a/src/server/scripts/EasternKingdoms/duskwood.cpp +++ b/src/server/scripts/EasternKingdoms/duskwood.cpp @@ -28,24 +28,30 @@ EndScriptData */ /*###### # at_twilight_grove ######*/ - -bool AreaTrigger_at_twilight_grove(Player* pPlayer, const AreaTriggerEntry * /*at*/) +
class at_twilight_grove : public AreaTriggerScript { - if (pPlayer->HasQuestForItem(21149)) +public: + at_twilight_grove() : AreaTriggerScript("at_twilight_grove") { } + + bool OnTrigger(Player* pPlayer, const AreaTriggerEntry * /*at*/) { - if (Unit* TCorrupter = pPlayer->SummonCreature(15625,-10328.16,-489.57,49.95,0,TEMPSUMMON_MANUAL_DESPAWN,60000)) - { - TCorrupter->setFaction(14); - TCorrupter->SetMaxHealth(832750); - } - if (Unit* CorrupterSpeaker = pPlayer->SummonCreature(1,pPlayer->GetPositionX(),pPlayer->GetPositionY(),pPlayer->GetPositionZ()-1,0,TEMPSUMMON_TIMED_DESPAWN,15000)) + if (pPlayer->HasQuestForItem(21149)) { - CorrupterSpeaker->SetName("Twilight Corrupter"); - CorrupterSpeaker->SetVisibility(VISIBILITY_ON); - CorrupterSpeaker->MonsterYell("Come, $N. See what the Nightmare brings...",0,pPlayer->GetGUID()); + if (Unit* TCorrupter = pPlayer->SummonCreature(15625,-10328.16,-489.57,49.95,0,TEMPSUMMON_MANUAL_DESPAWN,60000)) + { + TCorrupter->setFaction(14); + TCorrupter->SetMaxHealth(832750); + } + if (Unit* CorrupterSpeaker = pPlayer->SummonCreature(1,pPlayer->GetPositionX(),pPlayer->GetPositionY(),pPlayer->GetPositionZ()-1,0,TEMPSUMMON_TIMED_DESPAWN,15000)) + { + CorrupterSpeaker->SetName("Twilight Corrupter"); + CorrupterSpeaker->SetVisibility(VISIBILITY_ON); + CorrupterSpeaker->MonsterYell("Come, $N. See what the Nightmare brings...",0,pPlayer->GetGUID()); + } } - } - return false; + return false; + }; + }; /*###### @@ -55,74 +61,72 @@ bool AreaTrigger_at_twilight_grove(Player* pPlayer, const AreaTriggerEntry * /*a #define SPELL_SOUL_CORRUPTION 25805 #define SPELL_CREATURE_OF_NIGHTMARE 25806 #define SPELL_LEVEL_UP 24312 - -struct boss_twilight_corrupterAI : public ScriptedAI +
class boss_twilight_corrupter : public CreatureScript { - boss_twilight_corrupterAI(Creature *c) : ScriptedAI(c) {} +public: + boss_twilight_corrupter() : CreatureScript("boss_twilight_corrupter") { } - uint32 SoulCorruption_Timer; - uint32 CreatureOfNightmare_Timer; - uint8 KillCount; - - void Reset() - { - SoulCorruption_Timer = 15000; - CreatureOfNightmare_Timer = 30000; - KillCount = 0; - } - void EnterCombat(Unit* /*who*/) + CreatureAI* GetAI(Creature* pCreature) const { - me->MonsterYell("The Nightmare cannot be stopped!",0,me->GetGUID()); + return new boss_twilight_corrupterAI (pCreature); } - void KilledUnit(Unit* victim) + struct boss_twilight_corrupterAI : public ScriptedAI { - if (victim->GetTypeId() == TYPEID_PLAYER) + boss_twilight_corrupterAI(Creature *c) : ScriptedAI(c) {} + + uint32 SoulCorruption_Timer; + uint32 CreatureOfNightmare_Timer; + uint8 KillCount; + + void Reset() + { + SoulCorruption_Timer = 15000; + CreatureOfNightmare_Timer = 30000; + KillCount = 0; + } + void EnterCombat(Unit* /*who*/) { - ++KillCount; - me->MonsterTextEmote("Twilight Corrupter squeezes the last bit of life out of $N and swallows their soul.", victim->GetGUID(),true); + me->MonsterYell("The Nightmare cannot be stopped!",0,me->GetGUID()); + } - if (KillCount == 3) + void KilledUnit(Unit* victim) + { + if (victim->GetTypeId() == TYPEID_PLAYER) { - DoCast(me, SPELL_LEVEL_UP, true); - KillCount = 0; + ++KillCount; + me->MonsterTextEmote("Twilight Corrupter squeezes the last bit of life out of $N and swallows their soul.", victim->GetGUID(),true); + + if (KillCount == 3) + { + DoCast(me, SPELL_LEVEL_UP, true); + KillCount = 0; + } } } - } - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - if (SoulCorruption_Timer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_SOUL_CORRUPTION); - SoulCorruption_Timer = rand()%4000+15000; //gotta confirm Timers - } else SoulCorruption_Timer-=diff; - if (CreatureOfNightmare_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_CREATURE_OF_NIGHTMARE); - CreatureOfNightmare_Timer = 45000; //gotta confirm Timers - } else CreatureOfNightmare_Timer-=diff; - DoMeleeAttackIfReady(); + if (!UpdateVictim()) + return; + if (SoulCorruption_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_SOUL_CORRUPTION); + SoulCorruption_Timer = rand()%4000+15000; //gotta confirm Timers + } else SoulCorruption_Timer-=diff; + if (CreatureOfNightmare_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_CREATURE_OF_NIGHTMARE); + CreatureOfNightmare_Timer = 45000; //gotta confirm Timers + } else CreatureOfNightmare_Timer-=diff; + DoMeleeAttackIfReady(); + }; }; + }; -CreatureAI* GetAI_boss_twilight_corrupter(Creature* pCreature) -{ - return new boss_twilight_corrupterAI (pCreature); -} void AddSC_duskwood() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_twilight_corrupter"; - newscript->GetAI = &GetAI_boss_twilight_corrupter; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "at_twilight_grove"; - newscript->pAreaTrigger = &AreaTrigger_at_twilight_grove; - newscript->RegisterSelf(); + new boss_twilight_corrupter(); + new at_twilight_grove(); } diff --git a/src/server/scripts/EasternKingdoms/eastern_plaguelands.cpp b/src/server/scripts/EasternKingdoms/eastern_plaguelands.cpp index 32091439b1f..7a7421548a2 100644 --- a/src/server/scripts/EasternKingdoms/eastern_plaguelands.cpp +++ b/src/server/scripts/EasternKingdoms/eastern_plaguelands.cpp @@ -35,81 +35,103 @@ EndContentData */ //id8530 - cannibal ghoul //id8531 - gibbering ghoul //id8532 - diseased flayer - -struct mobs_ghoul_flayerAI : public ScriptedAI +
class mobs_ghoul_flayer : public CreatureScript { - mobs_ghoul_flayerAI(Creature *c) : ScriptedAI(c) {} - - void Reset() {} - - void EnterCombat(Unit* /*who*/) {} +public: + mobs_ghoul_flayer() : CreatureScript("mobs_ghoul_flayer") { } - void JustDied(Unit* Killer) + CreatureAI* GetAI(Creature* pCreature) const { - if (Killer->GetTypeId() == TYPEID_PLAYER) - me->SummonCreature(11064, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 60000); + return new mobs_ghoul_flayerAI (pCreature); } + + struct mobs_ghoul_flayerAI : public ScriptedAI + { + mobs_ghoul_flayerAI(Creature *c) : ScriptedAI(c) {} + + void Reset() {} + + void EnterCombat(Unit* /*who*/) {} + + void JustDied(Unit* Killer) + { + if (Killer->GetTypeId() == TYPEID_PLAYER) + me->SummonCreature(11064, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 60000); + } + }; + }; -CreatureAI* GetAI_mobs_ghoul_flayer(Creature* pCreature) -{ - return new mobs_ghoul_flayerAI (pCreature); -} /*###### ## npc_augustus_the_touched ######*/ - -bool GossipHello_npc_augustus_the_touched(Player* pPlayer, Creature* pCreature) +
class npc_augustus_the_touched : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); +public: + npc_augustus_the_touched() : CreatureScript("npc_augustus_the_touched") { } - if (pCreature->isVendor() && pPlayer->GetQuestRewardStatus(6164)) - 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()); + return true; + } - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - return true; -} + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + + if (pCreature->isVendor() && pPlayer->GetQuestRewardStatus(6164)) + 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; + } + +}; -bool GossipSelect_npc_augustus_the_touched(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_TRADE) - pPlayer->SEND_VENDORLIST(pCreature->GetGUID()); - return true; -} /*###### ## npc_darrowshire_spirit ######*/ #define SPELL_SPIRIT_SPAWNIN 17321 - -struct npc_darrowshire_spiritAI : public ScriptedAI +
class npc_darrowshire_spirit : public CreatureScript { - npc_darrowshire_spiritAI(Creature *c) : ScriptedAI(c) {} +public: + npc_darrowshire_spirit() : CreatureScript("npc_darrowshire_spirit") { } - void Reset() + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - DoCast(me, SPELL_SPIRIT_SPAWNIN); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + pPlayer->SEND_GOSSIP_MENU(3873, pCreature->GetGUID()); + pPlayer->TalkedToCreature(pCreature->GetEntry(), pCreature->GetGUID()); + pCreature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + return true; } - void EnterCombat(Unit * /*who*/) {} + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_darrowshire_spiritAI (pCreature); + } + + struct npc_darrowshire_spiritAI : public ScriptedAI + { + npc_darrowshire_spiritAI(Creature *c) : ScriptedAI(c) {} + + void Reset() + { + DoCast(me, SPELL_SPIRIT_SPAWNIN); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + } + + void EnterCombat(Unit * /*who*/) {} + + }; }; -CreatureAI* GetAI_npc_darrowshire_spirit(Creature* pCreature) -{ - return new npc_darrowshire_spiritAI (pCreature); -} -bool GossipHello_npc_darrowshire_spirit(Player* pPlayer, Creature* pCreature) -{ - pPlayer->SEND_GOSSIP_MENU(3873, pCreature->GetGUID()); - pPlayer->TalkedToCreature(pCreature->GetEntry(), pCreature->GetGUID()); - pCreature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - return true; -} /*###### ## npc_tirion_fordring @@ -119,69 +141,55 @@ bool GossipHello_npc_darrowshire_spirit(Player* pPlayer, Creature* pCreature) #define GOSSIP_SELECT1 "Thank you, Tirion. What of your identity?" #define GOSSIP_SELECT2 "That is terrible." #define GOSSIP_SELECT3 "I will, Tirion." - -bool GossipHello_npc_tirion_fordring(Player* pPlayer, Creature* pCreature) +
class npc_tirion_fordring : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); +public: + npc_tirion_fordring() : CreatureScript("npc_tirion_fordring") { } - if (pPlayer->GetQuestStatus(5742) == QUEST_STATUS_INCOMPLETE && pPlayer->getStandState() == UNIT_STAND_STATE_SIT) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + 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_SELECT1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + pPlayer->SEND_GOSSIP_MENU(4493, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+2: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); + pPlayer->SEND_GOSSIP_MENU(4494, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+3: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4); + pPlayer->SEND_GOSSIP_MENU(4495, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+4: + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->AreaExploredOrEventHappens(5742); + 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(5742) == QUEST_STATUS_INCOMPLETE && pPlayer->getStandState() == UNIT_STAND_STATE_SIT) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); -bool GossipSelect_npc_tirion_fordring(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - switch (uiAction) - { - case GOSSIP_ACTION_INFO_DEF+1: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - pPlayer->SEND_GOSSIP_MENU(4493, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+2: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); - pPlayer->SEND_GOSSIP_MENU(4494, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+3: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4); - pPlayer->SEND_GOSSIP_MENU(4495, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+4: - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->AreaExploredOrEventHappens(5742); - break; + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + + return true; } - return true; -} + +}; + void AddSC_eastern_plaguelands() { - Script *newscript; - - newscript = new Script; - newscript->Name = "mobs_ghoul_flayer"; - newscript->GetAI = &GetAI_mobs_ghoul_flayer; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_augustus_the_touched"; - newscript->pGossipHello = &GossipHello_npc_augustus_the_touched; - newscript->pGossipSelect = &GossipSelect_npc_augustus_the_touched; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_darrowshire_spirit"; - newscript->GetAI = &GetAI_npc_darrowshire_spirit; - newscript->pGossipHello = &GossipHello_npc_darrowshire_spirit; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_tirion_fordring"; - newscript->pGossipHello = &GossipHello_npc_tirion_fordring; - newscript->pGossipSelect = &GossipSelect_npc_tirion_fordring; - newscript->RegisterSelf(); + new mobs_ghoul_flayer(); + new npc_augustus_the_touched(); + new npc_darrowshire_spirit(); + new npc_tirion_fordring(); } - diff --git a/src/server/scripts/EasternKingdoms/elwynn_forest.cpp b/src/server/scripts/EasternKingdoms/elwynn_forest.cpp index 8b56c16f8fa..fb01585c2b4 100644 --- a/src/server/scripts/EasternKingdoms/elwynn_forest.cpp +++ b/src/server/scripts/EasternKingdoms/elwynn_forest.cpp @@ -34,70 +34,72 @@ EndContentData */ ######*/ #define SAY_HEAL -1100280 - -struct npc_henze_faulkAI : public ScriptedAI +
class npc_henze_faulk : public CreatureScript { - uint32 lifeTimer; - bool spellHit; - - npc_henze_faulkAI(Creature *c) : ScriptedAI(c) {} +public: + npc_henze_faulk() : CreatureScript("npc_henze_faulk") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - lifeTimer = 120000; - me->SetUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); - me->SetStandState(UNIT_STAND_STATE_DEAD); // lay down - spellHit = false; + return new npc_henze_faulkAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct npc_henze_faulkAI : public ScriptedAI { - } + uint32 lifeTimer; + bool spellHit; - void MoveInLineOfSight(Unit * /*who*/) - { - return; - } + npc_henze_faulkAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - if (me->IsStandState()) + void Reset() + { + lifeTimer = 120000; + me->SetUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); + me->SetStandState(UNIT_STAND_STATE_DEAD); // lay down + spellHit = false; + } + + void EnterCombat(Unit * /*who*/) + { + } + + void MoveInLineOfSight(Unit * /*who*/) { - if (lifeTimer <= diff) + return; + } + + void UpdateAI(const uint32 diff) + { + if (me->IsStandState()) { - EnterEvadeMode(); - return; + if (lifeTimer <= diff) + { + EnterEvadeMode(); + return; + } + else + lifeTimer -= diff; } - else - lifeTimer -= diff; } - } - void SpellHit(Unit * /*Hitter*/, const SpellEntry *Spellkind) - { - if (Spellkind->Id == 8593 && !spellHit) + void SpellHit(Unit * /*Hitter*/, const SpellEntry *Spellkind) { - DoCast(me, 32343); - me->SetStandState(UNIT_STAND_STATE_STAND); - me->SetUInt32Value(UNIT_DYNAMIC_FLAGS, 0); - //me->RemoveAllAuras(); - DoScriptText(SAY_HEAL, me); - spellHit = true; + if (Spellkind->Id == 8593 && !spellHit) + { + DoCast(me, 32343); + me->SetStandState(UNIT_STAND_STATE_STAND); + me->SetUInt32Value(UNIT_DYNAMIC_FLAGS, 0); + //me->RemoveAllAuras(); + DoScriptText(SAY_HEAL, me); + spellHit = true; + } } - } + + }; }; -CreatureAI* GetAI_npc_henze_faulk(Creature* pCreature) -{ - return new npc_henze_faulkAI (pCreature); -} void AddSC_elwynn_forest() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_henze_faulk"; - newscript->GetAI = &GetAI_npc_henze_faulk; - newscript->RegisterSelf(); + new npc_henze_faulk(); } diff --git a/src/server/scripts/EasternKingdoms/eversong_woods.cpp b/src/server/scripts/EasternKingdoms/eversong_woods.cpp index a463e3fb225..db377a9fe63 100644 --- a/src/server/scripts/EasternKingdoms/eversong_woods.cpp +++ b/src/server/scripts/EasternKingdoms/eversong_woods.cpp @@ -47,69 +47,78 @@ enum eProspectorAnvilward SAY_ANVIL2 = -1000210, QUEST_THE_DWARVEN_SPY = 8483, }; - -struct npc_prospector_anvilwardAI : public npc_escortAI +
class npc_prospector_anvilward : public CreatureScript { - // CreatureAI functions - npc_prospector_anvilwardAI(Creature *c) : npc_escortAI(c) {} +public: + npc_prospector_anvilward() : CreatureScript("npc_prospector_anvilward") { } - // Pure Virtual Functions - void WaypointReached(uint32 i) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - Player* pPlayer = GetPlayerForEscort(); - - if (!pPlayer) - return; - - switch (i) + switch(uiAction) { - case 0: DoScriptText(SAY_ANVIL1, me, pPlayer); break; - case 5: DoScriptText(SAY_ANVIL2, me, pPlayer); break; - case 6: me->setFaction(24); break; + case GOSSIP_ACTION_INFO_DEF+1: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); + pPlayer->SEND_GOSSIP_MENU(8240, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+2: + pPlayer->CLOSE_GOSSIP_MENU(); + if (npc_escortAI* pEscortAI = CAST_AI(npc_prospector_anvilward::npc_prospector_anvilwardAI, pCreature->AI())) + pEscortAI->Start(true, false, pPlayer->GetGUID()); + break; } + return true; } - void Reset() + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - me->RestoreFaction(); + if (pPlayer->GetQuestStatus(QUEST_THE_DWARVEN_SPY) == QUEST_STATUS_INCOMPLETE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + + pPlayer->SEND_GOSSIP_MENU(8239, pCreature->GetGUID()); + return true; } - void JustDied(Unit* /*killer*/) + CreatureAI* GetAI(Creature* pCreature) const { - me->RestoreFaction(); + return new npc_prospector_anvilwardAI(pCreature); } -}; -CreatureAI* GetAI_npc_prospector_anvilward(Creature* pCreature) -{ - return new npc_prospector_anvilwardAI(pCreature); -} + struct npc_prospector_anvilwardAI : public npc_escortAI + { + // CreatureAI functions + npc_prospector_anvilwardAI(Creature *c) : npc_escortAI(c) {} + + // Pure Virtual Functions + void WaypointReached(uint32 i) + { + Player* pPlayer = GetPlayerForEscort(); + + if (!pPlayer) + return; + + switch (i) + { + case 0: DoScriptText(SAY_ANVIL1, me, pPlayer); break; + case 5: DoScriptText(SAY_ANVIL2, me, pPlayer); break; + case 6: me->setFaction(24); break; + } + } + + void Reset() + { + me->RestoreFaction(); + } + + void JustDied(Unit* /*killer*/) + { + me->RestoreFaction(); + } + }; + +}; -bool GossipHello_npc_prospector_anvilward(Player* pPlayer, Creature* pCreature) -{ - if (pPlayer->GetQuestStatus(QUEST_THE_DWARVEN_SPY) == QUEST_STATUS_INCOMPLETE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(8239, pCreature->GetGUID()); - return true; -} -bool GossipSelect_npc_prospector_anvilward(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - switch(uiAction) - { - case GOSSIP_ACTION_INFO_DEF+1: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); - pPlayer->SEND_GOSSIP_MENU(8240, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+2: - pPlayer->CLOSE_GOSSIP_MENU(); - if (npc_escortAI* pEscortAI = CAST_AI(npc_prospector_anvilwardAI, pCreature->AI())) - pEscortAI->Start(true, false, pPlayer->GetGUID()); - break; - } - return true; -} /*###### ## Quest 9686 Second Trial @@ -167,275 +176,304 @@ static uint32 PaladinEntry[] = {CHAMPION_BLOODWRATH, CHAMPION_LIGHTREND, CHAMPIO /*###### ## npc_second_trial_paladin ######*/ - -struct npc_secondTrialAI : public ScriptedAI +
class npc_second_trial_paladin : public CreatureScript { - npc_secondTrialAI(Creature *c) : ScriptedAI(c) {} +public: + npc_second_trial_paladin() : CreatureScript("npc_second_trial_paladin") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_secondTrialAI (pCreature); + } - uint32 timer; - uint8 questPhase; - uint64 summonerGuid; + struct npc_secondTrialAI : public ScriptedAI + { + npc_secondTrialAI(Creature *c) : ScriptedAI(c) {} - bool spellFlashLight; - bool spellJustice; - bool spellJudLight; - bool spellCommand; + uint32 timer; + uint8 questPhase; + uint64 summonerGuid; - uint32 timerFlashLight; - uint32 timerJustice; - uint32 timerJudLight; - uint32 timerCommand; + bool spellFlashLight; + bool spellJustice; + bool spellJudLight; + bool spellCommand; - void Reset() - { + uint32 timerFlashLight; + uint32 timerJustice; + uint32 timerJudLight; + uint32 timerCommand; - timer = 2000; - questPhase = 0; - summonerGuid = 0; - - me->SetUInt32Value(UNIT_FIELD_BYTES_1, UNIT_STAND_STATE_KNEEL); - me->setFaction(FACTION_FRIENDLY); - - spellFlashLight = false; - spellJustice = false; - spellJudLight = false; - spellCommand = false; - - switch(me->GetEntry()) - { - case CHAMPION_BLOODWRATH: - spellFlashLight = true; - timerFlashLight = TIMER_FLASH_OF_LIGHT; - break; - case CHAMPION_LIGHTREND: - spellJustice = true; - timerJustice = 500; - break; - case CHAMPION_SWIFTBLADE: - spellJudLight = false; // Misses Script Effect // http://www.wowhead.com/?spell=20271 - timerJudLight = 500; - break; - case CHAMPION_SUNSTRIKER: - spellFlashLight = true; - spellJudLight = false; // Misses Script Effect // http://www.wowhead.com/?spell=20271 - spellCommand = false; // Misses Dummy // http://www.wowhead.com/?spell=20375 - timerFlashLight = TIMER_FLASH_OF_LIGHT; - timerJudLight = 500; - timerCommand = 1500; - break; - } - } + void Reset() + { - void EnterCombat(Unit * /*who*/) {} + timer = 2000; + questPhase = 0; + summonerGuid = 0; + + me->SetUInt32Value(UNIT_FIELD_BYTES_1, UNIT_STAND_STATE_KNEEL); + me->setFaction(FACTION_FRIENDLY); + + spellFlashLight = false; + spellJustice = false; + spellJudLight = false; + spellCommand = false; + + switch(me->GetEntry()) + { + case CHAMPION_BLOODWRATH: + spellFlashLight = true; + timerFlashLight = TIMER_FLASH_OF_LIGHT; + break; + case CHAMPION_LIGHTREND: + spellJustice = true; + timerJustice = 500; + break; + case CHAMPION_SWIFTBLADE: + spellJudLight = false; // Misses Script Effect // http://www.wowhead.com/?spell=20271 + timerJudLight = 500; + break; + case CHAMPION_SUNSTRIKER: + spellFlashLight = true; + spellJudLight = false; // Misses Script Effect // http://www.wowhead.com/?spell=20271 + spellCommand = false; // Misses Dummy // http://www.wowhead.com/?spell=20375 + timerFlashLight = TIMER_FLASH_OF_LIGHT; + timerJudLight = 500; + timerCommand = 1500; + break; + } + } - void UpdateAI(const uint32 diff) - { - if (questPhase == 1) - if (timer <= diff) - { - me->SetUInt32Value(UNIT_FIELD_BYTES_1, UNIT_STAND_STATE_STAND); - me->setFaction(FACTION_HOSTILE); - questPhase = 0; + void EnterCombat(Unit * /*who*/) {} - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + void UpdateAI(const uint32 diff) + { + if (questPhase == 1) + if (timer <= diff) { - me->AddThreat(pTarget, 5000000.0f); - AttackStart(pTarget); + me->SetUInt32Value(UNIT_FIELD_BYTES_1, UNIT_STAND_STATE_STAND); + me->setFaction(FACTION_HOSTILE); + questPhase = 0; + + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + { + me->AddThreat(pTarget, 5000000.0f); + AttackStart(pTarget); + } } - } - else - timer -= diff; + else + timer -= diff; - if (!UpdateVictim()) - return; + if (!UpdateVictim()) + return; - // healer - if (spellFlashLight) - if (me->GetHealth()*100 / me->GetMaxHealth() < 70) - if (timerFlashLight <= diff) + // healer + if (spellFlashLight) + if (me->GetHealth()*100 / me->GetMaxHealth() < 70) + if (timerFlashLight <= diff) + { + DoCast(me, SPELL_FLASH_OF_LIGHT); + timerFlashLight = TIMER_FLASH_OF_LIGHT + rand()%TIMER_FLASH_OF_LIGHT; + } + else + timerFlashLight -= diff; + + if (spellJustice) + if (timerJustice <= diff) { - DoCast(me, SPELL_FLASH_OF_LIGHT); - timerFlashLight = TIMER_FLASH_OF_LIGHT + rand()%TIMER_FLASH_OF_LIGHT; + DoCast(me, SPELL_SEAL_OF_JUSTICE); + timerJustice = TIMER_SEAL_OF_JUSTICE + rand()%TIMER_SEAL_OF_JUSTICE; } else - timerFlashLight -= diff; - - if (spellJustice) - if (timerJustice <= diff) - { - DoCast(me, SPELL_SEAL_OF_JUSTICE); - timerJustice = TIMER_SEAL_OF_JUSTICE + rand()%TIMER_SEAL_OF_JUSTICE; - } - else - timerJustice -= diff; + timerJustice -= diff; - if (spellJudLight) - if (timerJudLight <= diff) - { - DoCast(me, SPELL_JUDGEMENT_OF_LIGHT); - timerJudLight = TIMER_JUDGEMENT_OF_LIGHT + rand()%TIMER_JUDGEMENT_OF_LIGHT; - } - else - timerJudLight -= diff; - - if (spellCommand) - if (timerCommand <= diff) - { - DoCast(me, TIMER_SEAL_OF_COMMAND); - timerCommand = TIMER_SEAL_OF_COMMAND + rand()%TIMER_SEAL_OF_COMMAND; - } - else - timerCommand -= diff; + if (spellJudLight) + if (timerJudLight <= diff) + { + DoCast(me, SPELL_JUDGEMENT_OF_LIGHT); + timerJudLight = TIMER_JUDGEMENT_OF_LIGHT + rand()%TIMER_JUDGEMENT_OF_LIGHT; + } + else + timerJudLight -= diff; + + if (spellCommand) + if (timerCommand <= diff) + { + DoCast(me, TIMER_SEAL_OF_COMMAND); + timerCommand = TIMER_SEAL_OF_COMMAND + rand()%TIMER_SEAL_OF_COMMAND; + } + else + timerCommand -= diff; + + DoMeleeAttackIfReady(); + } - DoMeleeAttackIfReady(); - } + void Activate(uint64 summonerguid) + { + questPhase = 1; + summonerGuid = summonerguid; + } - void Activate(uint64 summonerguid); - void KilledUnit(Unit* Killed); - void JustDied(Unit* Killer); + void KilledUnit(Unit* Killed) + { + if (Killed->GetTypeId() == TYPEID_PLAYER) + if (CAST_PLR(Killed)->GetQuestStatus(QUEST_SECOND_TRIAL) == QUEST_STATUS_INCOMPLETE) + CAST_PLR(Killed)->FailQuest(QUEST_SECOND_TRIAL); + } + void JustDied(Unit* Killer); + }; }; /*###### ## npc_second_trial_controller ######*/ - -struct master_kelerun_bloodmournAI : public ScriptedAI +
class npc_second_trial_controller : public CreatureScript { - master_kelerun_bloodmournAI(Creature *c) : ScriptedAI(c) {} +public: + npc_second_trial_controller() : CreatureScript("npc_second_trial_controller") { } - uint8 questPhase; - uint8 paladinPhase; - uint32 timer; + bool OnQuestAccept(Player* /*pPlayer*/, Creature* pCreature, Quest const *quest) + { + // One Player exclusive quest, wait for user go activation + if (quest->GetQuestId() == QUEST_SECOND_TRIAL) + CAST_AI(npc_second_trial_controller::master_kelerun_bloodmournAI, pCreature->AI())->questPhase = 1; - uint64 paladinGuid[4]; + return true; + } - void Reset() + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - questPhase = 0; - timer = 60000; - paladinPhase = 0; - for (uint8 i = 0; i < 4; ++i) - paladinGuid[i] = 0; + // quest only available if not already started + // Quest_template flag is set to : QUEST_FLAGS_EVENT + // Escort quests or any other event-driven quests. If player in party, all players that can accept this quest will receive confirmation box to accept quest. + // !not sure if this really works! + + if (CAST_AI(npc_second_trial_controller::master_kelerun_bloodmournAI, pCreature->AI())->questPhase == 0) + { + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + pPlayer->SendPreparedQuest(pCreature->GetGUID()); + } + + pPlayer->SEND_GOSSIP_MENU(pCreature->GetEntry(), pCreature->GetGUID()); + return true; } - void EnterCombat(Unit * /*who*/) {} + CreatureAI* GetAI(Creature* pCreature) const + { + return new master_kelerun_bloodmournAI (pCreature); + } - void UpdateAI(const uint32 diff) + struct master_kelerun_bloodmournAI : public ScriptedAI { - // Quest accepted but object not activated, object despawned (if in sync 1 minute!) - if (questPhase == 1) + master_kelerun_bloodmournAI(Creature *c) : ScriptedAI(c) {} + + uint8 questPhase; + uint8 paladinPhase; + uint32 timer; + + uint64 paladinGuid[4]; + + void Reset() { - if (timer <= diff) - Reset(); - else - timer -= diff; + questPhase = 0; + timer = 60000; + paladinPhase = 0; + for (uint8 i = 0; i < 4; ++i) + paladinGuid[i] = 0; } - // fight the 4 paladin mobs phase - else if (questPhase == 2) + + void EnterCombat(Unit * /*who*/) {} + + void UpdateAI(const uint32 diff) { - if (timer <= diff) + // Quest accepted but object not activated, object despawned (if in sync 1 minute!) + if (questPhase == 1) { - if (Creature* paladinSpawn = Unit::GetCreature((*me), paladinGuid[paladinPhase])) + if (timer <= diff) + Reset(); + else + timer -= diff; + } + // fight the 4 paladin mobs phase + else if (questPhase == 2) + { + if (timer <= diff) { - CAST_AI(npc_secondTrialAI, paladinSpawn->AI())->Activate(me->GetGUID()); - - switch(paladinPhase) + if (Creature* paladinSpawn = Unit::GetCreature((*me), paladinGuid[paladinPhase])) { - case 0: - DoScriptText(TEXT_SECOND_TRIAL_1,me); - break; - case 1: - DoScriptText(TEXT_SECOND_TRIAL_2,me); - break; - case 2: - DoScriptText(TEXT_SECOND_TRIAL_3,me); - break; - case 3: - DoScriptText(TEXT_SECOND_TRIAL_4,me); - break; + CAST_AI(npc_second_trial_paladin::npc_secondTrialAI, paladinSpawn->AI())->Activate(me->GetGUID()); + + switch(paladinPhase) + { + case 0: + DoScriptText(TEXT_SECOND_TRIAL_1,me); + break; + case 1: + DoScriptText(TEXT_SECOND_TRIAL_2,me); + break; + case 2: + DoScriptText(TEXT_SECOND_TRIAL_3,me); + break; + case 3: + DoScriptText(TEXT_SECOND_TRIAL_4,me); + break; + } } + else + Reset(); + + questPhase = 4; + timer = OFFSET_NEXT_ATTACK; } else - Reset(); - - questPhase = 4; - timer = OFFSET_NEXT_ATTACK; + timer -= diff; } - else - timer -= diff; - } - - if (!UpdateVictim()) - return; - DoMeleeAttackIfReady(); - } - - void StartEvent() - { - - if (questPhase == 1) - { // no player check, quest can be finished as group, so no complex PlayerGUID/group search code - - for (uint8 i = 0; i < 4; ++i) - if (Creature *pSummoned = DoSpawnCreature(PaladinEntry[i], SpawnPosition[i].x, SpawnPosition[i].y, SpawnPosition[i].z, SpawnPosition[i].o, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 180000)) - paladinGuid[i] = pSummoned->GetGUID(); + if (!UpdateVictim()) + return; - timer = OFFSET_NEXT_ATTACK; - questPhase = 2; + DoMeleeAttackIfReady(); } - } - - void SecondTrialKill(); - void SummonedCreatureDespawn(Creature* /*c*/) {} -}; -bool GossipHello_master_kelerun_bloodmourn(Player* pPlayer, Creature* pCreature) -{ - // quest only available if not already started - // Quest_template flag is set to : QUEST_FLAGS_EVENT - // Escort quests or any other event-driven quests. If player in party, all players that can accept this quest will receive confirmation box to accept quest. - // !not sure if this really works! - - if (CAST_AI(master_kelerun_bloodmournAI, pCreature->AI())->questPhase == 0) - { - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - pPlayer->SendPreparedQuest(pCreature->GetGUID()); - } + void StartEvent() + { - pPlayer->SEND_GOSSIP_MENU(pCreature->GetEntry(), pCreature->GetGUID()); - return true; -} + if (questPhase == 1) + { // no player check, quest can be finished as group, so no complex PlayerGUID/group search code -bool QuestAccept_master_kelerun_bloodmourn(Player* /*pPlayer*/, Creature* pCreature, Quest const *quest) -{ - // One Player exclusive quest, wait for user go activation - if (quest->GetQuestId() == QUEST_SECOND_TRIAL) - CAST_AI(master_kelerun_bloodmournAI, pCreature->AI())->questPhase = 1; + for (uint8 i = 0; i < 4; ++i) + if (Creature *pSummoned = DoSpawnCreature(PaladinEntry[i], SpawnPosition[i].x, SpawnPosition[i].y, SpawnPosition[i].z, SpawnPosition[i].o, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 180000)) + paladinGuid[i] = pSummoned->GetGUID(); - return true; -} + timer = OFFSET_NEXT_ATTACK; + questPhase = 2; + } + } -void master_kelerun_bloodmournAI::SecondTrialKill() -{ - if (questPhase > 0) - { - ++paladinPhase; + void SecondTrialKill() + { + if (questPhase > 0) + { + ++paladinPhase; + + if (paladinPhase < 4) + questPhase = 2; + else + Reset(); // Quest Complete, QuestComplete handler is + } + } - if (paladinPhase < 4) - questPhase = 2; - else - Reset(); // Quest Complete, QuestComplete handler is in npc_secondTrialAI::JustDied - } -} + void SummonedCreatureDespawn(Creature* /*c*/) {} + }; +}; -void npc_secondTrialAI::JustDied(Unit* Killer) +void npc_second_trial_paladin::npc_secondTrialAI::JustDied(Unit* Killer) { if (Killer->GetTypeId() == TYPEID_PLAYER) { if (Creature *pSummoner = Unit::GetCreature((*me), summonerGuid)) - CAST_AI(master_kelerun_bloodmournAI, pSummoner->AI())->SecondTrialKill(); + CAST_AI(npc_second_trial_controller::master_kelerun_bloodmournAI, pSummoner->AI())->SecondTrialKill(); // last kill quest complete for group if (me->GetEntry() == CHAMPION_SUNSTRIKER) @@ -446,41 +484,26 @@ void npc_secondTrialAI::JustDied(Unit* Killer) } } -void npc_secondTrialAI::KilledUnit(Unit* Killed) -{ - if (Killed->GetTypeId() == TYPEID_PLAYER) - if (CAST_PLR(Killed)->GetQuestStatus(QUEST_SECOND_TRIAL) == QUEST_STATUS_INCOMPLETE) - CAST_PLR(Killed)->FailQuest(QUEST_SECOND_TRIAL); -} - -void npc_secondTrialAI::Activate(uint64 summonerguid) -{ - questPhase = 1; - summonerGuid = summonerguid; -} - -CreatureAI* GetAI_master_kelerun_bloodmourn(Creature* pCreature) -{ - return new master_kelerun_bloodmournAI (pCreature); -} - -CreatureAI* GetAI_npc_secondTrial(Creature* pCreature) -{ - return new npc_secondTrialAI (pCreature); -} /*###### ## go_second_trial ######*/ - -bool GOHello_go_second_trial(Player* /*pPlayer*/, GameObject* pGO) +class go_second_trial : public GameObjectScript { - // find spawn :: master_kelerun_bloodmourn - if (Creature *pCreature = pGO->FindNearestCreature(MASTER_KELERUN_BLOODMOURN, 30.0f)) - CAST_AI(master_kelerun_bloodmournAI, pCreature->AI())->StartEvent(); +public: + go_second_trial() : GameObjectScript("go_second_trial") { } + + bool OnGossipHello(Player* /*pPlayer*/, GameObject* pGO) + { + // find spawn :: master_kelerun_bloodmourn + if (Creature *pCreature = pGO->FindNearestCreature(MASTER_KELERUN_BLOODMOURN, 30.0f)) + CAST_AI(npc_second_trial_controller::master_kelerun_bloodmournAI, pCreature->AI())->StartEvent(); + + return true; + } + +}; - return true; -} /*###### ## npc_apprentice_mirveda @@ -489,75 +512,82 @@ bool GOHello_go_second_trial(Player* /*pPlayer*/, GameObject* pGO) #define QUEST_UNEXPECTED_RESULT 8488 #define MOB_GHARZUL 15958 #define MOB_ANGERSHADE 15656 - -struct npc_apprentice_mirvedaAI : public ScriptedAI +
class npc_apprentice_mirveda : public CreatureScript { - npc_apprentice_mirvedaAI(Creature* c) : ScriptedAI(c), Summons(me) {} - - uint32 KillCount; - uint64 PlayerGUID; - bool Summon; - SummonList Summons; - - void Reset() - { - KillCount = 0; - PlayerGUID = 0; - Summons.DespawnAll(); - Summon = false; - } +public: + npc_apprentice_mirveda() : CreatureScript("npc_apprentice_mirveda") { } - void EnterCombat(Unit* /*who*/){} - - void JustSummoned(Creature *summoned) + bool OnQuestAccept(Player* pPlayer, Creature* pCreature, Quest const* quest) { - summoned->AI()->AttackStart(me); - Summons.Summon(summoned); + if (quest->GetQuestId() == QUEST_UNEXPECTED_RESULT) + { + CAST_AI(npc_apprentice_mirveda::npc_apprentice_mirvedaAI, pCreature->AI())->Summon = true; + CAST_AI(npc_apprentice_mirveda::npc_apprentice_mirvedaAI, pCreature->AI())->PlayerGUID = pPlayer->GetGUID(); + } + return true; } - void SummonedCreatureDespawn(Creature* summoned) + CreatureAI* GetAI(Creature* pCreature) const { - Summons.Despawn(summoned); - ++KillCount; + return new npc_apprentice_mirvedaAI (pCreature); } - void JustDied(Unit* /*killer*/) + struct npc_apprentice_mirvedaAI : public ScriptedAI { - if (PlayerGUID) - if (Player* pPlayer = Unit::GetPlayer(*me, PlayerGUID)) - CAST_PLR(pPlayer)->FailQuest(QUEST_UNEXPECTED_RESULT); - } + npc_apprentice_mirvedaAI(Creature* c) : ScriptedAI(c), Summons(me) {} - void UpdateAI(const uint32 /*diff*/) - { - if (KillCount >= 3 && PlayerGUID) - if (Player* pPlayer = Unit::GetPlayer(*me, PlayerGUID)) - CAST_PLR(pPlayer)->CompleteQuest(QUEST_UNEXPECTED_RESULT); + uint32 KillCount; + uint64 PlayerGUID; + bool Summon; + SummonList Summons; - if (Summon) + void Reset() { - me->SummonCreature(MOB_GHARZUL, 8745, -7134.32, 35.22, 0, TEMPSUMMON_CORPSE_DESPAWN, 4000); - me->SummonCreature(MOB_ANGERSHADE, 8745, -7134.32, 35.22, 0, TEMPSUMMON_CORPSE_DESPAWN, 4000); - me->SummonCreature(MOB_ANGERSHADE, 8745, -7134.32, 35.22, 0, TEMPSUMMON_CORPSE_DESPAWN, 4000); + KillCount = 0; + PlayerGUID = 0; + Summons.DespawnAll(); Summon = false; } - } -}; -bool QuestAccept_npc_apprentice_mirveda(Player* pPlayer, Creature* pCreature, Quest const* quest) -{ - if (quest->GetQuestId() == QUEST_UNEXPECTED_RESULT) - { - CAST_AI(npc_apprentice_mirvedaAI, pCreature->AI())->Summon = true; - CAST_AI(npc_apprentice_mirvedaAI, pCreature->AI())->PlayerGUID = pPlayer->GetGUID(); - } - return true; -} + void EnterCombat(Unit* /*who*/){} + + void JustSummoned(Creature *summoned) + { + summoned->AI()->AttackStart(me); + Summons.Summon(summoned); + } + + void SummonedCreatureDespawn(Creature* summoned) + { + Summons.Despawn(summoned); + ++KillCount; + } + + void JustDied(Unit* /*killer*/) + { + if (PlayerGUID) + if (Player* pPlayer = Unit::GetPlayer(*me, PlayerGUID)) + CAST_PLR(pPlayer)->FailQuest(QUEST_UNEXPECTED_RESULT); + } + + void UpdateAI(const uint32 /*diff*/) + { + if (KillCount >= 3 && PlayerGUID) + if (Player* pPlayer = Unit::GetPlayer(*me, PlayerGUID)) + CAST_PLR(pPlayer)->CompleteQuest(QUEST_UNEXPECTED_RESULT); + + if (Summon) + { + me->SummonCreature(MOB_GHARZUL, 8745, -7134.32, 35.22, 0, TEMPSUMMON_CORPSE_DESPAWN, 4000); + me->SummonCreature(MOB_ANGERSHADE, 8745, -7134.32, 35.22, 0, TEMPSUMMON_CORPSE_DESPAWN, 4000); + me->SummonCreature(MOB_ANGERSHADE, 8745, -7134.32, 35.22, 0, TEMPSUMMON_CORPSE_DESPAWN, 4000); + Summon = false; + } + } + }; + +}; -CreatureAI* GetAI_npc_apprentice_mirvedaAI(Creature* pCreature) -{ - return new npc_apprentice_mirvedaAI (pCreature); -} /*###### ## npc_infused_crystal @@ -583,120 +613,96 @@ static Location SpawnLocations[] = {8278.51, -7242.13, 139.162}, {8267.97, -7239.17, 139.517} }; - -struct npc_infused_crystalAI : public Scripted_NoMovementAI +
class npc_infused_crystal : public CreatureScript { - npc_infused_crystalAI(Creature* c) : Scripted_NoMovementAI(c) {} - - uint32 EndTimer; - uint32 WaveTimer; - bool Completed; - bool Progress; - uint64 PlayerGUID; +public: + npc_infused_crystal() : CreatureScript("npc_infused_crystal") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - EndTimer = 0; - Completed = false; - Progress = false; - PlayerGUID = 0; - WaveTimer = 0; + return new npc_infused_crystalAI (pCreature); } - void MoveInLineOfSight(Unit* who) + struct npc_infused_crystalAI : public Scripted_NoMovementAI { - if (!Progress && who->GetTypeId() == TYPEID_PLAYER && me->IsWithinDistInMap(who, 10.0f)) + npc_infused_crystalAI(Creature* c) : Scripted_NoMovementAI(c) {} + + uint32 EndTimer; + uint32 WaveTimer; + bool Completed; + bool Progress; + uint64 PlayerGUID; + + void Reset() { - if (CAST_PLR(who)->GetQuestStatus(QUEST_POWERING_OUR_DEFENSES) == QUEST_STATUS_INCOMPLETE) + EndTimer = 0; + Completed = false; + Progress = false; + PlayerGUID = 0; + WaveTimer = 0; + } + + void MoveInLineOfSight(Unit* who) + { + if (!Progress && who->GetTypeId() == TYPEID_PLAYER && me->IsWithinDistInMap(who, 10.0f)) { - PlayerGUID = who->GetGUID(); - WaveTimer = 1000; - EndTimer = 60000; - Progress = true; + if (CAST_PLR(who)->GetQuestStatus(QUEST_POWERING_OUR_DEFENSES) == QUEST_STATUS_INCOMPLETE) + { + PlayerGUID = who->GetGUID(); + WaveTimer = 1000; + EndTimer = 60000; + Progress = true; + } } } - } - void JustSummoned(Creature *summoned) - { - summoned->AI()->AttackStart(me); - } - - void JustDied(Unit* /*killer*/) - { - if (PlayerGUID && !Completed) - if (Player* pPlayer = Unit::GetPlayer(*me, PlayerGUID)) - CAST_PLR(pPlayer)->FailQuest(QUEST_POWERING_OUR_DEFENSES); - } + void JustSummoned(Creature *summoned) + { + summoned->AI()->AttackStart(me); + } - void UpdateAI(const uint32 diff) - { - if (EndTimer < diff && Progress) + void JustDied(Unit* /*killer*/) { - DoScriptText(EMOTE, me); - Completed = true; - if (PlayerGUID) + if (PlayerGUID && !Completed) if (Player* pPlayer = Unit::GetPlayer(*me, PlayerGUID)) - CAST_PLR(pPlayer)->CompleteQuest(QUEST_POWERING_OUR_DEFENSES); - - me->DealDamage(me,me->GetHealth(),NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); - me->RemoveCorpse(); - } else EndTimer -= diff; + CAST_PLR(pPlayer)->FailQuest(QUEST_POWERING_OUR_DEFENSES); + } - if (WaveTimer < diff && !Completed && Progress) + void UpdateAI(const uint32 diff) { - uint32 ran1 = rand()%8; - uint32 ran2 = rand()%8; - uint32 ran3 = rand()%8; - me->SummonCreature(MOB_ENRAGED_WRAITH, SpawnLocations[ran1].x, SpawnLocations[ran1].y, SpawnLocations[ran1].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10000); - me->SummonCreature(MOB_ENRAGED_WRAITH, SpawnLocations[ran2].x, SpawnLocations[ran2].y, SpawnLocations[ran2].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10000); - me->SummonCreature(MOB_ENRAGED_WRAITH, SpawnLocations[ran3].x, SpawnLocations[ran3].y, SpawnLocations[ran3].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10000); - WaveTimer = 30000; - } else WaveTimer -= diff; - } -}; + if (EndTimer < diff && Progress) + { + DoScriptText(EMOTE, me); + Completed = true; + if (PlayerGUID) + if (Player* pPlayer = Unit::GetPlayer(*me, PlayerGUID)) + CAST_PLR(pPlayer)->CompleteQuest(QUEST_POWERING_OUR_DEFENSES); -CreatureAI* GetAI_npc_infused_crystalAI(Creature* pCreature) -{ - return new npc_infused_crystalAI (pCreature); -} + me->DealDamage(me,me->GetHealth(),NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + me->RemoveCorpse(); + } else EndTimer -= diff; + + if (WaveTimer < diff && !Completed && Progress) + { + uint32 ran1 = rand()%8; + uint32 ran2 = rand()%8; + uint32 ran3 = rand()%8; + me->SummonCreature(MOB_ENRAGED_WRAITH, SpawnLocations[ran1].x, SpawnLocations[ran1].y, SpawnLocations[ran1].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10000); + me->SummonCreature(MOB_ENRAGED_WRAITH, SpawnLocations[ran2].x, SpawnLocations[ran2].y, SpawnLocations[ran2].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10000); + me->SummonCreature(MOB_ENRAGED_WRAITH, SpawnLocations[ran3].x, SpawnLocations[ran3].y, SpawnLocations[ran3].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10000); + WaveTimer = 30000; + } else WaveTimer -= diff; + } + }; + +}; void AddSC_eversong_woods() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_prospector_anvilward"; - newscript->GetAI = &GetAI_npc_prospector_anvilward; - newscript->pGossipHello = &GossipHello_npc_prospector_anvilward; - newscript->pGossipSelect = &GossipSelect_npc_prospector_anvilward; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_second_trial_controller"; - newscript->GetAI = &GetAI_master_kelerun_bloodmourn; - newscript->pGossipHello = &GossipHello_master_kelerun_bloodmourn; - newscript->pQuestAccept = &QuestAccept_master_kelerun_bloodmourn; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_second_trial_paladin"; - newscript->GetAI = &GetAI_npc_secondTrial; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "go_second_trial"; - newscript->pGOHello = &GOHello_go_second_trial; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_apprentice_mirveda"; - newscript->GetAI = &GetAI_npc_apprentice_mirvedaAI; - newscript->pQuestAccept = &QuestAccept_npc_apprentice_mirveda; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_infused_crystal"; - newscript->GetAI = &GetAI_npc_infused_crystalAI; - newscript->RegisterSelf(); + new npc_prospector_anvilward(); + new npc_second_trial_controller(); + new npc_second_trial_paladin(); + new go_second_trial(); + new npc_apprentice_mirveda(); + new npc_infused_crystal(); } diff --git a/src/server/scripts/EasternKingdoms/ghostlands.cpp b/src/server/scripts/EasternKingdoms/ghostlands.cpp index a33974b2ecd..5ce868444a4 100644 --- a/src/server/scripts/EasternKingdoms/ghostlands.cpp +++ b/src/server/scripts/EasternKingdoms/ghostlands.cpp @@ -38,85 +38,106 @@ EndContentData */ ######*/ #define GOSSIP_H_BKD "Take Blood Knight Insignia" - -bool GossipHello_npc_blood_knight_dawnstar(Player* pPlayer, Creature* pCreature) +
class npc_blood_knight_dawnstar : public CreatureScript { - if (pPlayer->GetQuestStatus(9692) == QUEST_STATUS_INCOMPLETE && !pPlayer->HasItemCount(24226,1,true)) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_H_BKD, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); +public: + npc_blood_knight_dawnstar() : CreatureScript("npc_blood_knight_dawnstar") { } - return true; -} - -bool GossipSelect_npc_blood_knight_dawnstar(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, 24226, 1, false); - if (msg == EQUIP_ERR_OK) + if (uiAction == GOSSIP_ACTION_INFO_DEF+1) { - pPlayer->StoreNewItem(dest, 24226, 1, true); - pPlayer->PlayerTalkClass->ClearMenus(); + ItemPosCountVec dest; + uint8 msg = pPlayer->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, 24226, 1, false); + if (msg == EQUIP_ERR_OK) + { + pPlayer->StoreNewItem(dest, 24226, 1, true); + pPlayer->PlayerTalkClass->ClearMenus(); + } } + return true; } - return true; -} + + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pPlayer->GetQuestStatus(9692) == QUEST_STATUS_INCOMPLETE && !pPlayer->HasItemCount(24226,1,true)) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_H_BKD, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + + return true; + } + +}; + /*###### ## npc_budd_nedreck ######*/ #define GOSSIP_HBN "You gave the crew disguises?" - -bool GossipHello_npc_budd_nedreck(Player* pPlayer, Creature* pCreature) +
class npc_budd_nedreck : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); +public: + npc_budd_nedreck() : CreatureScript("npc_budd_nedreck") { } - if (pPlayer->GetQuestStatus(11166) == QUEST_STATUS_INCOMPLETE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HBN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - - 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->CLOSE_GOSSIP_MENU(); + pCreature->CastSpell(pPlayer, 42540, false); + } + return true; + } -bool GossipSelect_npc_budd_nedreck(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF) + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - pPlayer->CLOSE_GOSSIP_MENU(); - pCreature->CastSpell(pPlayer, 42540, false); + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + + if (pPlayer->GetQuestStatus(11166) == QUEST_STATUS_INCOMPLETE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HBN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); + + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + return true; } - return true; -} + +}; + /*###### ## npc_rathis_tomber ######*/ - -bool GossipHello_npc_rathis_tomber(Player* pPlayer, Creature* pCreature) +
class npc_rathis_tomber : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); +public: + npc_rathis_tomber() : CreatureScript("npc_rathis_tomber") { } - if (pCreature->isVendor() && pPlayer->GetQuestRewardStatus(9152)) + 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(8432, pCreature->GetGUID()); - }else - pPlayer->SEND_GOSSIP_MENU(8431, pCreature->GetGUID()); + if (uiAction == GOSSIP_ACTION_TRADE) + pPlayer->SEND_VENDORLIST(pCreature->GetGUID()); + return true; + } - return true; -} + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + + if (pCreature->isVendor() && pPlayer->GetQuestRewardStatus(9152)) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); + pPlayer->SEND_GOSSIP_MENU(8432, pCreature->GetGUID()); + }else + pPlayer->SEND_GOSSIP_MENU(8431, pCreature->GetGUID()); + + return true; + } + +}; -bool GossipSelect_npc_rathis_tomber(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_TRADE) - pPlayer->SEND_VENDORLIST(pCreature->GetGUID()); - return true; -} /*###### ## npc_ranger_lilatha @@ -137,116 +158,102 @@ enum eEnums NPC_CAPTAIN_HELIOS = 16220, FACTION_SMOON_E = 1603, }; - -struct npc_ranger_lilathaAI : public npc_escortAI +
class npc_ranger_lilatha : public CreatureScript { - npc_ranger_lilathaAI(Creature *c) : npc_escortAI(c) {} +public: + npc_ranger_lilatha() : CreatureScript("npc_ranger_lilatha") { } - void WaypointReached(uint32 i) + struct npc_ranger_lilathaAI : public npc_escortAI { - Player* pPlayer = GetPlayerForEscort(); + npc_ranger_lilathaAI(Creature *c) : npc_escortAI(c) {} - if (!pPlayer) - return; - - switch(i) + void WaypointReached(uint32 i) { - case 0: - { - me->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); - if (GameObject* Cage = me->FindNearestGameObject(GO_CAGE, 20)) - Cage->SetGoState(GO_STATE_ACTIVE); - DoScriptText(SAY_START, me, pPlayer); - break; - } - case 5: - DoScriptText(SAY_PROGRESS1, me, pPlayer); - case 11: - DoScriptText(SAY_PROGRESS2, me, pPlayer); - me->SetOrientation(4.762841); - break; - case 18: - { - DoScriptText(SAY_PROGRESS3, me, pPlayer); - Creature* Summ1 = me->SummonCreature(16342, 7627.083984, -7532.538086, 152.128616, 1.082733, TEMPSUMMON_DEAD_DESPAWN, 0); - Creature* Summ2 = me->SummonCreature(16343, 7620.432129, -7532.550293, 152.454865, 0.827478, TEMPSUMMON_DEAD_DESPAWN, 0); - if (Summ1 && Summ2) + Player* pPlayer = GetPlayerForEscort(); + + if (!pPlayer) + return; + + switch(i) { - Summ1->Attack(me, true); - Summ2->Attack(pPlayer, true); - } - me->AI()->AttackStart(Summ1); - break; + case 0: + { + me->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); + if (GameObject* Cage = me->FindNearestGameObject(GO_CAGE, 20)) + Cage->SetGoState(GO_STATE_ACTIVE); + DoScriptText(SAY_START, me, pPlayer); + break; + } + case 5: + DoScriptText(SAY_PROGRESS1, me, pPlayer); + case 11: + DoScriptText(SAY_PROGRESS2, me, pPlayer); + me->SetOrientation(4.762841); + break; + case 18: + { + DoScriptText(SAY_PROGRESS3, me, pPlayer); + Creature* Summ1 = me->SummonCreature(16342, 7627.083984, -7532.538086, 152.128616, 1.082733, TEMPSUMMON_DEAD_DESPAWN, 0); + Creature* Summ2 = me->SummonCreature(16343, 7620.432129, -7532.550293, 152.454865, 0.827478, TEMPSUMMON_DEAD_DESPAWN, 0); + if (Summ1 && Summ2) + { + Summ1->Attack(me, true); + Summ2->Attack(pPlayer, true); + } + me->AI()->AttackStart(Summ1); + break; + } + case 19: me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); break; + case 25: me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); break; + case 30: + if (pPlayer && pPlayer->GetTypeId() == TYPEID_PLAYER) + CAST_PLR(pPlayer)->GroupEventHappens(QUEST_ESCAPE_FROM_THE_CATACOMBS,me); + break; + case 32: + me->SetOrientation(2.978281); + DoScriptText(SAY_END1, me, pPlayer); + break; + case 33: + me->SetOrientation(5.858011); + DoScriptText(SAY_END2, me, pPlayer); + Unit* CaptainHelios = me->FindNearestCreature(NPC_CAPTAIN_HELIOS, 50); + if (CaptainHelios) + DoScriptText(SAY_CAPTAIN_ANSWER, CaptainHelios, pPlayer); + break; } - case 19: me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); break; - case 25: me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); break; - case 30: - if (pPlayer && pPlayer->GetTypeId() == TYPEID_PLAYER) - CAST_PLR(pPlayer)->GroupEventHappens(QUEST_ESCAPE_FROM_THE_CATACOMBS,me); - break; - case 32: - me->SetOrientation(2.978281); - DoScriptText(SAY_END1, me, pPlayer); - break; - case 33: - me->SetOrientation(5.858011); - DoScriptText(SAY_END2, me, pPlayer); - Unit* CaptainHelios = me->FindNearestCreature(NPC_CAPTAIN_HELIOS, 50); - if (CaptainHelios) - DoScriptText(SAY_CAPTAIN_ANSWER, CaptainHelios, pPlayer); - break; } - } - void Reset() + void Reset() + { + if (GameObject* Cage = me->FindNearestGameObject(GO_CAGE, 20)) + Cage->SetGoState(GO_STATE_READY); + } + }; + + bool OnQuestAccept(Player* pPlayer, Creature* pCreature, Quest const* quest) { - if (GameObject* Cage = me->FindNearestGameObject(GO_CAGE, 20)) - Cage->SetGoState(GO_STATE_READY); + if (quest->GetQuestId() == QUEST_ESCAPE_FROM_THE_CATACOMBS) + { + pCreature->setFaction(113); + + if (npc_escortAI* pEscortAI = CAST_AI(npc_ranger_lilatha::npc_ranger_lilathaAI, pCreature->AI())) + pEscortAI->Start(true, false, pPlayer->GetGUID()); + } + return true; } -}; -bool QuestAccept_npc_ranger_lilatha(Player* pPlayer, Creature* pCreature, Quest const* quest) -{ - if (quest->GetQuestId() == QUEST_ESCAPE_FROM_THE_CATACOMBS) + CreatureAI* GetAI(Creature* pCreature) const { - pCreature->setFaction(113); - - if (npc_escortAI* pEscortAI = CAST_AI(npc_ranger_lilathaAI, pCreature->AI())) - pEscortAI->Start(true, false, pPlayer->GetGUID()); + return new npc_ranger_lilathaAI(pCreature); } - return true; -} -CreatureAI* GetAI_npc_ranger_lilathaAI(Creature* pCreature) -{ - return new npc_ranger_lilathaAI(pCreature); -} +}; + void AddSC_ghostlands() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_blood_knight_dawnstar"; - newscript->pGossipHello = &GossipHello_npc_blood_knight_dawnstar; - newscript->pGossipSelect = &GossipSelect_npc_blood_knight_dawnstar; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_budd_nedreck"; - newscript->pGossipHello = &GossipHello_npc_budd_nedreck; - newscript->pGossipSelect = &GossipSelect_npc_budd_nedreck; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_rathis_tomber"; - newscript->pGossipHello = &GossipHello_npc_rathis_tomber; - newscript->pGossipSelect = &GossipSelect_npc_rathis_tomber; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_ranger_lilatha"; - newscript->GetAI = &GetAI_npc_ranger_lilathaAI; - newscript->pQuestAccept = &QuestAccept_npc_ranger_lilatha; - newscript->RegisterSelf(); + new npc_blood_knight_dawnstar(); + new npc_budd_nedreck(); + new npc_rathis_tomber(); + new npc_ranger_lilatha(); } diff --git a/src/server/scripts/EasternKingdoms/hinterlands.cpp b/src/server/scripts/EasternKingdoms/hinterlands.cpp index 081d1b157e6..1ce459560d1 100644 --- a/src/server/scripts/EasternKingdoms/hinterlands.cpp +++ b/src/server/scripts/EasternKingdoms/hinterlands.cpp @@ -51,96 +51,104 @@ enum eOOX FACTION_ESCORTEE_A = 774, FACTION_ESCORTEE_H = 775 }; - -struct npc_00x09hlAI : public npc_escortAI +
class npc_00x09hl : public CreatureScript { - npc_00x09hlAI(Creature* pCreature) : npc_escortAI(pCreature) { } - - void Reset() { } +public: + npc_00x09hl() : CreatureScript("npc_00x09hl") { } - void WaypointReached(uint32 uiPointId) + bool OnQuestAccept(Player* pPlayer, Creature* pCreature, const Quest* pQuest) { - switch(uiPointId) + if (pQuest->GetQuestId() == QUEST_RESQUE_OOX_09) { - case 26: - DoScriptText(SAY_OOX_AMBUSH, me); - break; - case 43: - DoScriptText(SAY_OOX_AMBUSH, me); - break; - case 64: - DoScriptText(SAY_OOX_END, me); - if (Player* pPlayer = GetPlayerForEscort()) - pPlayer->GroupEventHappens(QUEST_RESQUE_OOX_09, me); - break; + pCreature->SetStandState(UNIT_STAND_STATE_STAND); + + if (pPlayer->GetTeam() == ALLIANCE) + pCreature->setFaction(FACTION_ESCORTEE_A); + else if (pPlayer->GetTeam() == HORDE) + pCreature->setFaction(FACTION_ESCORTEE_H); + + DoScriptText(SAY_OOX_START, pCreature, pPlayer); + + if (npc_00x09hlAI* pEscortAI = CAST_AI(npc_00x09hl::npc_00x09hlAI, pCreature->AI())) + pEscortAI->Start(false, false, pPlayer->GetGUID(), pQuest); } + return true; } - void WaypointStart(uint32 uiPointId) + CreatureAI* GetAI(Creature* pCreature) const { - switch(uiPointId) - { - case 27: - for (uint8 i = 0; i < 3; ++i) - { - const Position src = {147.927444f, -3851.513428f, 130.893f, 0}; - Position dst; - me->GetRandomPoint(src, 7.0f, dst); - DoSummon(NPC_MARAUDING_OWL, dst, 25000, TEMPSUMMON_CORPSE_TIMED_DESPAWN); - } - break; - case 44: - for (uint8 i = 0; i < 3; ++i) - { - const Position src = {-141.151581f, -4291.213867f, 120.130f, 0}; - Position dst; - me->GetRandomPoint(src, 7.0f, dst); - me->SummonCreature(NPC_VILE_AMBUSHER, dst, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 25000); - } - break; - } + return new npc_00x09hlAI(pCreature); } - void EnterCombat(Unit* pWho) + struct npc_00x09hlAI : public npc_escortAI { - if (pWho->GetEntry() == NPC_MARAUDING_OWL || pWho->GetEntry() == NPC_VILE_AMBUSHER) - return; + npc_00x09hlAI(Creature* pCreature) : npc_escortAI(pCreature) { } - if (rand()%1) - DoScriptText(SAY_OOX_AGGRO1, me); - else - DoScriptText(SAY_OOX_AGGRO2, me); - } + void Reset() { } - void JustSummoned(Creature* pSummoned) - { - pSummoned->GetMotionMaster()->MovePoint(0, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()); - } -}; + void WaypointReached(uint32 uiPointId) + { + switch(uiPointId) + { + case 26: + DoScriptText(SAY_OOX_AMBUSH, me); + break; + case 43: + DoScriptText(SAY_OOX_AMBUSH, me); + break; + case 64: + DoScriptText(SAY_OOX_END, me); + if (Player* pPlayer = GetPlayerForEscort()) + pPlayer->GroupEventHappens(QUEST_RESQUE_OOX_09, me); + break; + } + } -bool QuestAccept_npc_00x09hl(Player* pPlayer, Creature* pCreature, const Quest* pQuest) -{ - if (pQuest->GetQuestId() == QUEST_RESQUE_OOX_09) - { - pCreature->SetStandState(UNIT_STAND_STATE_STAND); + void WaypointStart(uint32 uiPointId) + { + switch(uiPointId) + { + case 27: + for (uint8 i = 0; i < 3; ++i) + { + const Position src = {147.927444f, -3851.513428f, 130.893f, 0}; + Position dst; + me->GetRandomPoint(src, 7.0f, dst); + DoSummon(NPC_MARAUDING_OWL, dst, 25000, TEMPSUMMON_CORPSE_TIMED_DESPAWN); + } + break; + case 44: + for (uint8 i = 0; i < 3; ++i) + { + const Position src = {-141.151581f, -4291.213867f, 120.130f, 0}; + Position dst; + me->GetRandomPoint(src, 7.0f, dst); + me->SummonCreature(NPC_VILE_AMBUSHER, dst, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 25000); + } + break; + } + } - if (pPlayer->GetTeam() == ALLIANCE) - pCreature->setFaction(FACTION_ESCORTEE_A); - else if (pPlayer->GetTeam() == HORDE) - pCreature->setFaction(FACTION_ESCORTEE_H); + void EnterCombat(Unit* pWho) + { + if (pWho->GetEntry() == NPC_MARAUDING_OWL || pWho->GetEntry() == NPC_VILE_AMBUSHER) + return; - DoScriptText(SAY_OOX_START, pCreature, pPlayer); + if (rand()%1) + DoScriptText(SAY_OOX_AGGRO1, me); + else + DoScriptText(SAY_OOX_AGGRO2, me); + } + + void JustSummoned(Creature* pSummoned) + { + pSummoned->GetMotionMaster()->MovePoint(0, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()); + } + }; + +}; - if (npc_00x09hlAI* pEscortAI = CAST_AI(npc_00x09hlAI, pCreature->AI())) - pEscortAI->Start(false, false, pPlayer->GetGUID(), pQuest); - } - return true; -} -CreatureAI* GetAI_npc_00x09hl(Creature* pCreature) -{ - return new npc_00x09hlAI(pCreature); -} /*###### ## npc_rinji @@ -178,175 +186,172 @@ Location m_afAmbushMoveTo[] = {166.630386, -2824.780273, 108.153}, {70.886589, -2874.335449, 116.675} }; - -struct npc_rinjiAI : public npc_escortAI +
class npc_rinji : public CreatureScript { - npc_rinjiAI(Creature* pCreature) : npc_escortAI(pCreature) +public: + npc_rinji() : CreatureScript("npc_rinji") { } + + bool OnQuestAccept(Player* pPlayer, Creature* pCreature, const Quest* pQuest) { - m_bIsByOutrunner = false; - m_iSpawnId = 0; - } + if (pQuest->GetQuestId() == QUEST_RINJI_TRAPPED) + { + if (GameObject* pGo = pCreature->FindNearestGameObject(GO_RINJI_CAGE, INTERACTION_DISTANCE)) + pGo->UseDoorOrButton(); - bool m_bIsByOutrunner; - uint32 m_uiPostEventCount; - uint32 m_uiPostEventTimer; - int m_iSpawnId; + if (npc_rinjiAI* pEscortAI = CAST_AI(npc_rinji::npc_rinjiAI, pCreature->AI())) + pEscortAI->Start(false, false, pPlayer->GetGUID(), pQuest); + } + return true; + } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - m_uiPostEventCount = 0; - m_uiPostEventTimer = 3000; + return new npc_rinjiAI(pCreature); } - void JustRespawned() + struct npc_rinjiAI : public npc_escortAI { - m_bIsByOutrunner = false; - m_iSpawnId = 0; + npc_rinjiAI(Creature* pCreature) : npc_escortAI(pCreature) + { + m_bIsByOutrunner = false; + m_iSpawnId = 0; + } - npc_escortAI::JustRespawned(); - } + bool m_bIsByOutrunner; + uint32 m_uiPostEventCount; + uint32 m_uiPostEventTimer; + int m_iSpawnId; - void EnterCombat(Unit* pWho) - { - if (HasEscortState(STATE_ESCORT_ESCORTING)) + void Reset() { - if (pWho->GetEntry() == NPC_OUTRUNNER && !m_bIsByOutrunner) - { - DoScriptText(SAY_RIN_BY_OUTRUNNER, pWho); - m_bIsByOutrunner = true; - } + m_uiPostEventCount = 0; + m_uiPostEventTimer = 3000; + } - if (rand()%4) - return; + void JustRespawned() + { + m_bIsByOutrunner = false; + m_iSpawnId = 0; - //only if attacked and escorter is not in combat? - DoScriptText(RAND(SAY_RIN_HELP_1,SAY_RIN_HELP_2), me); + npc_escortAI::JustRespawned(); } - } - void DoSpawnAmbush(bool bFirst) - { - if (!bFirst) - m_iSpawnId = 1; + void EnterCombat(Unit* pWho) + { + if (HasEscortState(STATE_ESCORT_ESCORTING)) + { + if (pWho->GetEntry() == NPC_OUTRUNNER && !m_bIsByOutrunner) + { + DoScriptText(SAY_RIN_BY_OUTRUNNER, pWho); + m_bIsByOutrunner = true; + } - me->SummonCreature(NPC_RANGER, - m_afAmbushSpawn[m_iSpawnId].m_fX, m_afAmbushSpawn[m_iSpawnId].m_fY, m_afAmbushSpawn[m_iSpawnId].m_fZ, 0.0f, - TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 60000); + if (rand()%4) + return; - for (int i = 0; i < 2; ++i) + //only if attacked and escorter is not in combat? + DoScriptText(RAND(SAY_RIN_HELP_1,SAY_RIN_HELP_2), me); + } + } + + void DoSpawnAmbush(bool bFirst) { - me->SummonCreature(NPC_OUTRUNNER, + if (!bFirst) + m_iSpawnId = 1; + + me->SummonCreature(NPC_RANGER, m_afAmbushSpawn[m_iSpawnId].m_fX, m_afAmbushSpawn[m_iSpawnId].m_fY, m_afAmbushSpawn[m_iSpawnId].m_fZ, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 60000); + + for (int i = 0; i < 2; ++i) + { + me->SummonCreature(NPC_OUTRUNNER, + m_afAmbushSpawn[m_iSpawnId].m_fX, m_afAmbushSpawn[m_iSpawnId].m_fY, m_afAmbushSpawn[m_iSpawnId].m_fZ, 0.0f, + TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 60000); + } } - } - void JustSummoned(Creature* pSummoned) - { - pSummoned->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - pSummoned->GetMotionMaster()->MovePoint(0, m_afAmbushMoveTo[m_iSpawnId].m_fX, m_afAmbushMoveTo[m_iSpawnId].m_fY, m_afAmbushMoveTo[m_iSpawnId].m_fZ); - } + void JustSummoned(Creature* pSummoned) + { + pSummoned->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + pSummoned->GetMotionMaster()->MovePoint(0, m_afAmbushMoveTo[m_iSpawnId].m_fX, m_afAmbushMoveTo[m_iSpawnId].m_fY, m_afAmbushMoveTo[m_iSpawnId].m_fZ); + } - void WaypointReached(uint32 uiPointId) - { - Player* pPlayer = GetPlayerForEscort(); + void WaypointReached(uint32 uiPointId) + { + Player* pPlayer = GetPlayerForEscort(); - if (!pPlayer) - return; + if (!pPlayer) + return; - switch(uiPointId) - { - case 1: - DoScriptText(SAY_RIN_FREE, me, pPlayer); - break; - case 7: - DoSpawnAmbush(true); - break; - case 13: - DoSpawnAmbush(false); - break; - case 17: - DoScriptText(SAY_RIN_COMPLETE, me, pPlayer); - pPlayer->GroupEventHappens(QUEST_RINJI_TRAPPED, me); - SetRun(); - m_uiPostEventCount = 1; - break; + switch(uiPointId) + { + case 1: + DoScriptText(SAY_RIN_FREE, me, pPlayer); + break; + case 7: + DoSpawnAmbush(true); + break; + case 13: + DoSpawnAmbush(false); + break; + case 17: + DoScriptText(SAY_RIN_COMPLETE, me, pPlayer); + pPlayer->GroupEventHappens(QUEST_RINJI_TRAPPED, me); + SetRun(); + m_uiPostEventCount = 1; + break; + } } - } - void UpdateEscortAI(const uint32 uiDiff) - { - //Check if we have a current target - if (!UpdateVictim()) + void UpdateEscortAI(const uint32 uiDiff) { - if (HasEscortState(STATE_ESCORT_ESCORTING) && m_uiPostEventCount) + //Check if we have a current target + if (!UpdateVictim()) { - if (m_uiPostEventTimer <= uiDiff) + if (HasEscortState(STATE_ESCORT_ESCORTING) && m_uiPostEventCount) { - m_uiPostEventTimer = 3000; - - if (Unit* pPlayer = GetPlayerForEscort()) + if (m_uiPostEventTimer <= uiDiff) { - switch(m_uiPostEventCount) + m_uiPostEventTimer = 3000; + + if (Unit* pPlayer = GetPlayerForEscort()) + { + switch(m_uiPostEventCount) + { + case 1: + DoScriptText(SAY_RIN_PROGRESS_1, me, pPlayer); + ++m_uiPostEventCount; + break; + case 2: + DoScriptText(SAY_RIN_PROGRESS_2, me, pPlayer); + m_uiPostEventCount = 0; + break; + } + } + else { - case 1: - DoScriptText(SAY_RIN_PROGRESS_1, me, pPlayer); - ++m_uiPostEventCount; - break; - case 2: - DoScriptText(SAY_RIN_PROGRESS_2, me, pPlayer); - m_uiPostEventCount = 0; - break; + me->ForcedDespawn(); + return; } } else - { - me->ForcedDespawn(); - return; - } + m_uiPostEventTimer -= uiDiff; } - else - m_uiPostEventTimer -= uiDiff; + + return; } - return; + DoMeleeAttackIfReady(); } + }; - DoMeleeAttackIfReady(); - } }; -bool QuestAccept_npc_rinji(Player* pPlayer, Creature* pCreature, const Quest* pQuest) -{ - if (pQuest->GetQuestId() == QUEST_RINJI_TRAPPED) - { - if (GameObject* pGo = pCreature->FindNearestGameObject(GO_RINJI_CAGE, INTERACTION_DISTANCE)) - pGo->UseDoorOrButton(); - - if (npc_rinjiAI* pEscortAI = CAST_AI(npc_rinjiAI, pCreature->AI())) - pEscortAI->Start(false, false, pPlayer->GetGUID(), pQuest); - } - return true; -} -CreatureAI* GetAI_npc_rinji(Creature* pCreature) -{ - return new npc_rinjiAI(pCreature); -} void AddSC_hinterlands() { - Script* newscript; - - newscript = new Script; - newscript->Name = "npc_00x09hl"; - newscript->GetAI = &GetAI_npc_00x09hl; - newscript->pQuestAccept = &QuestAccept_npc_00x09hl; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_rinji"; - newscript->GetAI = &GetAI_npc_rinji; - newscript->pQuestAccept = &QuestAccept_npc_rinji; - newscript->RegisterSelf(); + new npc_00x09hl(); + new npc_rinji(); } diff --git a/src/server/scripts/EasternKingdoms/ironforge.cpp b/src/server/scripts/EasternKingdoms/ironforge.cpp index da215065c6d..a29f24814b7 100644 --- a/src/server/scripts/EasternKingdoms/ironforge.cpp +++ b/src/server/scripts/EasternKingdoms/ironforge.cpp @@ -38,58 +38,59 @@ EndContentData */ #define GOSSIP_ITEM_ROYAL_2 "Interesting, continue please." #define GOSSIP_ITEM_ROYAL_3 "Unbelievable! How dare they??" #define GOSSIP_ITEM_ROYAL_4 "Of course I will help!" - -bool GossipHello_npc_royal_historian_archesonus(Player* pPlayer, Creature* pCreature) +
class npc_royal_historian_archesonus : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); +public: + npc_royal_historian_archesonus() : CreatureScript("npc_royal_historian_archesonus") { } - if (pPlayer->GetQuestStatus(3702) == QUEST_STATUS_INCOMPLETE) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ROYAL, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - pPlayer->SEND_GOSSIP_MENU(2235, pCreature->GetGUID()); + switch (uiAction) + { + case GOSSIP_ACTION_INFO_DEF: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ROYAL_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + pPlayer->SEND_GOSSIP_MENU(2236, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+1: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ROYAL_2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + pPlayer->SEND_GOSSIP_MENU(2237, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+2: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ROYAL_3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); + pPlayer->SEND_GOSSIP_MENU(2238, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+3: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ROYAL_4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4); + pPlayer->SEND_GOSSIP_MENU(2239, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+4: + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->AreaExploredOrEventHappens(3702); + break; + } + return true; } - else - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - - return true; -} -bool GossipSelect_npc_royal_historian_archesonus(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_ITEM_ROYAL_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - pPlayer->SEND_GOSSIP_MENU(2236, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+1: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ROYAL_2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - pPlayer->SEND_GOSSIP_MENU(2237, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+2: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ROYAL_3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); - pPlayer->SEND_GOSSIP_MENU(2238, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+3: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ROYAL_4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4); - pPlayer->SEND_GOSSIP_MENU(2239, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+4: - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->AreaExploredOrEventHappens(3702); - break; + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + + if (pPlayer->GetQuestStatus(3702) == QUEST_STATUS_INCOMPLETE) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ROYAL, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); + pPlayer->SEND_GOSSIP_MENU(2235, pCreature->GetGUID()); + } + else + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + + return true; } - return true; -} + +}; + void AddSC_ironforge() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_royal_historian_archesonus"; - newscript->pGossipHello = &GossipHello_npc_royal_historian_archesonus; - newscript->pGossipSelect = &GossipSelect_npc_royal_historian_archesonus; - newscript->RegisterSelf(); + new npc_royal_historian_archesonus(); } diff --git a/src/server/scripts/EasternKingdoms/isle_of_queldanas.cpp b/src/server/scripts/EasternKingdoms/isle_of_queldanas.cpp index 2bb7a723b06..122ae3b864f 100644 --- a/src/server/scripts/EasternKingdoms/isle_of_queldanas.cpp +++ b/src/server/scripts/EasternKingdoms/isle_of_queldanas.cpp @@ -38,47 +38,54 @@ EndContentData */ #define SAY_CONVERTED_2 -1000189 #define SPELL_CONVERT_CREDIT 45009 - -struct npc_converted_sentryAI : public ScriptedAI +
class npc_converted_sentry : public CreatureScript { - npc_converted_sentryAI(Creature *c) : ScriptedAI(c) {} - - bool Credit; - uint32 Timer; +public: + npc_converted_sentry() : CreatureScript("npc_converted_sentry") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - Credit = false; - Timer = 2500; + return new npc_converted_sentryAI (pCreature); } - void MoveInLineOfSight(Unit * /*who*/) {} - void EnterCombat(Unit* /*who*/) {} - - void UpdateAI(const uint32 diff) + struct npc_converted_sentryAI : public ScriptedAI { - if (!Credit) + npc_converted_sentryAI(Creature *c) : ScriptedAI(c) {} + + bool Credit; + uint32 Timer; + + void Reset() + { + Credit = false; + Timer = 2500; + } + + void MoveInLineOfSight(Unit * /*who*/) {} + void EnterCombat(Unit* /*who*/) {} + + void UpdateAI(const uint32 diff) { - if (Timer <= diff) + if (!Credit) { - uint32 i = urand(1,2); - if (i == 1) - DoScriptText(SAY_CONVERTED_1, me); - else - DoScriptText(SAY_CONVERTED_2, me); - - DoCast(me, SPELL_CONVERT_CREDIT); - if (me->isPet()) - CAST_PET(me)->SetDuration(7500); - Credit = true; - } else Timer -= diff; + if (Timer <= diff) + { + uint32 i = urand(1,2); + if (i == 1) + DoScriptText(SAY_CONVERTED_1, me); + else + DoScriptText(SAY_CONVERTED_2, me); + + DoCast(me, SPELL_CONVERT_CREDIT); + if (me->isPet()) + CAST_PET(me)->SetDuration(7500); + Credit = true; + } else Timer -= diff; + } } - } + }; + }; -CreatureAI* GetAI_npc_converted_sentry(Creature* pCreature) -{ - return new npc_converted_sentryAI (pCreature); -} /*###### ## npc_greengill_slave @@ -88,66 +95,63 @@ CreatureAI* GetAI_npc_converted_sentry(Creature* pCreature) #define ORB 45109 #define QUESTG 11541 #define DM 25060 - -struct npc_greengill_slaveAI : public ScriptedAI +
class npc_greengill_slave : public CreatureScript { - npc_greengill_slaveAI(Creature* c) : ScriptedAI(c) {} - - uint64 PlayerGUID; +public: + npc_greengill_slave() : CreatureScript("npc_greengill_slave") { } - void EnterCombat(Unit* /*who*/){} - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - PlayerGUID = 0; + return new npc_greengill_slaveAI(pCreature); } - void SpellHit(Unit* caster, const SpellEntry* spell) + struct npc_greengill_slaveAI : public ScriptedAI { - if (!caster) - return; + npc_greengill_slaveAI(Creature* c) : ScriptedAI(c) {} + + uint64 PlayerGUID; - if (caster->GetTypeId() == TYPEID_PLAYER && spell->Id == ORB && !me->HasAura(ENRAGE)) + void EnterCombat(Unit* /*who*/){} + + void Reset() { - PlayerGUID = caster->GetGUID(); - if (PlayerGUID) - { - Unit* plr = Unit::GetUnit((*me), PlayerGUID); - if (plr && CAST_PLR(plr)->GetQuestStatus(QUESTG) == QUEST_STATUS_INCOMPLETE) - DoCast(plr, 45110, true); - } - DoCast(me, ENRAGE); - Unit* Myrmidon = me->FindNearestCreature(DM, 70); - if (Myrmidon) + PlayerGUID = 0; + } + + void SpellHit(Unit* caster, const SpellEntry* spell) + { + if (!caster) + return; + + if (caster->GetTypeId() == TYPEID_PLAYER && spell->Id == ORB && !me->HasAura(ENRAGE)) { - me->AddThreat(Myrmidon, 100000.0f); - AttackStart(Myrmidon); + PlayerGUID = caster->GetGUID(); + if (PlayerGUID) + { + Unit* plr = Unit::GetUnit((*me), PlayerGUID); + if (plr && CAST_PLR(plr)->GetQuestStatus(QUESTG) == QUEST_STATUS_INCOMPLETE) + DoCast(plr, 45110, true); + } + DoCast(me, ENRAGE); + Unit* Myrmidon = me->FindNearestCreature(DM, 70); + if (Myrmidon) + { + me->AddThreat(Myrmidon, 100000.0f); + AttackStart(Myrmidon); + } } } - } - void UpdateAI(const uint32 /*diff*/) - { - DoMeleeAttackIfReady(); - } -}; + void UpdateAI(const uint32 /*diff*/) + { + DoMeleeAttackIfReady(); + } + }; -CreatureAI* GetAI_npc_greengill_slaveAI(Creature* pCreature) -{ - return new npc_greengill_slaveAI(pCreature); -} +}; void AddSC_isle_of_queldanas() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_converted_sentry"; - newscript->GetAI = &GetAI_npc_converted_sentry; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_greengill_slave"; - newscript->GetAI = &GetAI_npc_greengill_slaveAI; - newscript->RegisterSelf(); + new npc_converted_sentry(); + new npc_greengill_slave(); } diff --git a/src/server/scripts/EasternKingdoms/loch_modan.cpp b/src/server/scripts/EasternKingdoms/loch_modan.cpp index 1a5dafb8b17..f54792407fb 100644 --- a/src/server/scripts/EasternKingdoms/loch_modan.cpp +++ b/src/server/scripts/EasternKingdoms/loch_modan.cpp @@ -41,62 +41,63 @@ EndContentData */ #define GOSSIP_MP4 "Yes..." #define GOSSIP_MP5 "Ok, i'll try to remember that." #define GOSSIP_MP6 "A key? Ok!" - -bool GossipHello_npc_mountaineer_pebblebitty(Player* pPlayer, Creature* pCreature) +
class npc_mountaineer_pebblebitty : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); +public: + npc_mountaineer_pebblebitty() : CreatureScript("npc_mountaineer_pebblebitty") { } - if (!pPlayer->GetQuestRewardStatus(3181) == 1) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_MP, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + 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_MP1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + pPlayer->SEND_GOSSIP_MENU(1833, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+2: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_MP2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); + pPlayer->SEND_GOSSIP_MENU(1834, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+3: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_MP3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4); + pPlayer->SEND_GOSSIP_MENU(1835, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+4: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_MP4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5); + pPlayer->SEND_GOSSIP_MENU(1836, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+5: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_MP5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 6); + pPlayer->SEND_GOSSIP_MENU(1837, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+6: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_MP6, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 7); + pPlayer->SEND_GOSSIP_MENU(1838, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+7: + pPlayer->CLOSE_GOSSIP_MENU(); + 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->GetQuestRewardStatus(3181) == 1) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_MP, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); -bool GossipSelect_npc_mountaineer_pebblebitty(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - switch (uiAction) - { - case GOSSIP_ACTION_INFO_DEF+1: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_MP1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - pPlayer->SEND_GOSSIP_MENU(1833, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+2: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_MP2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); - pPlayer->SEND_GOSSIP_MENU(1834, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+3: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_MP3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4); - pPlayer->SEND_GOSSIP_MENU(1835, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+4: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_MP4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5); - pPlayer->SEND_GOSSIP_MENU(1836, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+5: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_MP5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 6); - pPlayer->SEND_GOSSIP_MENU(1837, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+6: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_MP6, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 7); - pPlayer->SEND_GOSSIP_MENU(1838, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+7: - pPlayer->CLOSE_GOSSIP_MENU(); - break; + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + + return true; } - return true; -} + +}; + void AddSC_loch_modan() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_mountaineer_pebblebitty"; - newscript->pGossipHello = &GossipHello_npc_mountaineer_pebblebitty; - newscript->pGossipSelect = &GossipSelect_npc_mountaineer_pebblebitty; - newscript->RegisterSelf(); + new npc_mountaineer_pebblebitty(); } diff --git a/src/server/scripts/EasternKingdoms/redridge_mountains.cpp b/src/server/scripts/EasternKingdoms/redridge_mountains.cpp index f6e45c2711a..0a288ce7e20 100644 --- a/src/server/scripts/EasternKingdoms/redridge_mountains.cpp +++ b/src/server/scripts/EasternKingdoms/redridge_mountains.cpp @@ -37,136 +37,138 @@ enum eCorporalKeeshan SPELL_MOCKING_BLOW = 21008, SPELL_SHIELD_BASH = 11972, }; - -struct npc_corporal_keeshanAI : public npc_escortAI +
class npc_corporal_keeshan : public CreatureScript { - npc_corporal_keeshanAI(Creature* pCreature) : npc_escortAI(pCreature) {} +public: + npc_corporal_keeshan() : CreatureScript("npc_corporal_keeshan") { } - uint32 uiPhase; - uint32 uiTimer; - uint32 uiMockingBlowTimer; - uint32 uiShieldBashTimer; + bool OnQuestAccept(Player* pPlayer, Creature* pCreature, Quest const *pQuest) + { + if (pQuest->GetQuestId() == QUEST_MISSING_IN_ACTION) + { + CAST_AI(npc_corporal_keeshan::npc_corporal_keeshanAI,pCreature->AI())->Start(true, false, pPlayer->GetGUID(),pQuest); + DoScriptText(SAY_CORPORAL_1, pCreature); + } - void Reset() + return false; + } + + CreatureAI* GetAI(Creature* pCreature) const { - uiTimer = 0; - uiPhase = 0; - uiMockingBlowTimer = 5000; - uiShieldBashTimer = 8000; + return new npc_corporal_keeshanAI(pCreature); } - void WaypointReached(uint32 uiI) + struct npc_corporal_keeshanAI : public npc_escortAI { - Player* pPlayer = GetPlayerForEscort(); + npc_corporal_keeshanAI(Creature* pCreature) : npc_escortAI(pCreature) {} - if (!pPlayer) - return; + uint32 uiPhase; + uint32 uiTimer; + uint32 uiMockingBlowTimer; + uint32 uiShieldBashTimer; - if (uiI >= 65 && me->GetUnitMovementFlags() == MOVEMENTFLAG_WALKING) - me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + void Reset() + { + uiTimer = 0; + uiPhase = 0; + uiMockingBlowTimer = 5000; + uiShieldBashTimer = 8000; + } - switch(uiI) + void WaypointReached(uint32 uiI) { - case 39: - SetEscortPaused(true); - uiTimer = 2000; - uiPhase = 1; - break; - case 65: + Player* pPlayer = GetPlayerForEscort(); + + if (!pPlayer) + return; + + if (uiI >= 65 && me->GetUnitMovementFlags() == MOVEMENTFLAG_WALKING) me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - break; - case 115: - pPlayer->AreaExploredOrEventHappens(QUEST_MISSING_IN_ACTION); - uiTimer = 2000; - uiPhase = 4; - break; + + switch(uiI) + { + case 39: + SetEscortPaused(true); + uiTimer = 2000; + uiPhase = 1; + break; + case 65: + me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + break; + case 115: + pPlayer->AreaExploredOrEventHappens(QUEST_MISSING_IN_ACTION); + uiTimer = 2000; + uiPhase = 4; + break; + } } - } - void UpdateAI(const uint32 uiDiff) - { - if (HasEscortState(STATE_ESCORT_NONE)) - return; + void UpdateAI(const uint32 uiDiff) + { + if (HasEscortState(STATE_ESCORT_NONE)) + return; - npc_escortAI::UpdateAI(uiDiff); + npc_escortAI::UpdateAI(uiDiff); - if (uiPhase) - { - if (uiTimer <= uiDiff) + if (uiPhase) { - switch(uiPhase) + if (uiTimer <= uiDiff) { - case 1: - me->SetStandState(UNIT_STAND_STATE_SIT); - uiTimer = 1000; - uiPhase = 2; - break; - case 2: - DoScriptText(SAY_CORPORAL_2,me); - uiTimer = 15000; - uiPhase = 3; - break; - case 3: - DoScriptText(SAY_CORPORAL_3,me); - me->SetStandState(UNIT_STAND_STATE_STAND); - SetEscortPaused(false); - uiTimer = 0; - uiPhase = 0; - break; - case 4: - DoScriptText(SAY_CORPORAL_4, me); - uiTimer = 2500; - uiPhase = 5; - case 5: - DoScriptText(SAY_CORPORAL_5, me); - uiTimer = 0; - uiPhase = 0; - } - } else uiTimer -= uiDiff; - } - - if (!UpdateVictim()) - return; + switch(uiPhase) + { + case 1: + me->SetStandState(UNIT_STAND_STATE_SIT); + uiTimer = 1000; + uiPhase = 2; + break; + case 2: + DoScriptText(SAY_CORPORAL_2,me); + uiTimer = 15000; + uiPhase = 3; + break; + case 3: + DoScriptText(SAY_CORPORAL_3,me); + me->SetStandState(UNIT_STAND_STATE_STAND); + SetEscortPaused(false); + uiTimer = 0; + uiPhase = 0; + break; + case 4: + DoScriptText(SAY_CORPORAL_4, me); + uiTimer = 2500; + uiPhase = 5; + case 5: + DoScriptText(SAY_CORPORAL_5, me); + uiTimer = 0; + uiPhase = 0; + } + } else uiTimer -= uiDiff; + } + + if (!UpdateVictim()) + return; + + if (uiMockingBlowTimer <= uiDiff) + { + DoCast(me->getVictim(),SPELL_MOCKING_BLOW); + uiMockingBlowTimer = 5000; + } else uiMockingBlowTimer -= uiDiff; - if (uiMockingBlowTimer <= uiDiff) - { - DoCast(me->getVictim(),SPELL_MOCKING_BLOW); - uiMockingBlowTimer = 5000; - } else uiMockingBlowTimer -= uiDiff; + if (uiShieldBashTimer <= uiDiff) + { + DoCast(me->getVictim(),SPELL_MOCKING_BLOW); + uiShieldBashTimer = 8000; + } else uiShieldBashTimer -= uiDiff; - if (uiShieldBashTimer <= uiDiff) - { - DoCast(me->getVictim(),SPELL_MOCKING_BLOW); - uiShieldBashTimer = 8000; - } else uiShieldBashTimer -= uiDiff; + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -bool QuestAccept_npc_corporal_keeshan(Player* pPlayer, Creature* pCreature, Quest const *pQuest) -{ - if (pQuest->GetQuestId() == QUEST_MISSING_IN_ACTION) - { - CAST_AI(npc_corporal_keeshanAI,pCreature->AI())->Start(true, false, pPlayer->GetGUID(),pQuest); - DoScriptText(SAY_CORPORAL_1, pCreature); - } - - return false; -} -CreatureAI* GetAI_npc_corporal_keeshan(Creature* pCreature) -{ - return new npc_corporal_keeshanAI(pCreature); -} void AddSC_redridge_mountains() { - Script* newscript; - - newscript = new Script; - newscript->Name = "npc_corporal_keeshan"; - newscript->GetAI = &GetAI_npc_corporal_keeshan; - newscript->pQuestAccept = &QuestAccept_npc_corporal_keeshan; - newscript->RegisterSelf(); + new npc_corporal_keeshan(); } diff --git a/src/server/scripts/EasternKingdoms/searing_gorge.cpp b/src/server/scripts/EasternKingdoms/searing_gorge.cpp index 602fdeb2b59..ef6a0152154 100644 --- a/src/server/scripts/EasternKingdoms/searing_gorge.cpp +++ b/src/server/scripts/EasternKingdoms/searing_gorge.cpp @@ -38,69 +38,83 @@ EndContentData */ #define GOSSIP_HELLO_KW "Tell me what drives this vengance?" #define GOSSIP_SELECT_KW1 "Continue please" #define GOSSIP_SELECT_KW2 "Let me confer with my colleagues" - -bool GossipHello_npc_kalaran_windblade(Player* pPlayer, Creature* pCreature) +
class npc_kalaran_windblade : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); +public: + npc_kalaran_windblade() : CreatureScript("npc_kalaran_windblade") { } - if (pPlayer->GetQuestStatus(3441) == QUEST_STATUS_INCOMPLETE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_KW, 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_SELECT_KW1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + pPlayer->SEND_GOSSIP_MENU(1954, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+1: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT_KW2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + pPlayer->SEND_GOSSIP_MENU(1955, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+2: + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->AreaExploredOrEventHappens(3441); + 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(3441) == QUEST_STATUS_INCOMPLETE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_KW, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); -bool GossipSelect_npc_kalaran_windblade(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - switch (uiAction) - { - case GOSSIP_ACTION_INFO_DEF: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT_KW1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - pPlayer->SEND_GOSSIP_MENU(1954, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+1: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT_KW2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - pPlayer->SEND_GOSSIP_MENU(1955, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+2: - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->AreaExploredOrEventHappens(3441); - break; + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + + return true; } - return true; -} + +}; + /*###### ## npc_lothos_riftwaker ######*/ #define GOSSIP_HELLO_LR "Teleport me to the Molten Core" - -bool GossipHello_npc_lothos_riftwaker(Player* pPlayer, Creature* pCreature) +
class npc_lothos_riftwaker : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - - if (pPlayer->GetQuestRewardStatus(7487) || pPlayer->GetQuestRewardStatus(7848)) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_LR, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); +public: + npc_lothos_riftwaker() : CreatureScript("npc_lothos_riftwaker") { } - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + bool OnGossipSelect(Player* pPlayer, Creature* /*pCreature*/, uint32 /*uiSender*/, uint32 uiAction) + { + if (uiAction == GOSSIP_ACTION_INFO_DEF + 1) + { + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->TeleportTo(409, 1096, -467, -104.6, 3.64); + } - return true; -} + return true; + } -bool GossipSelect_npc_lothos_riftwaker(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(); - pPlayer->TeleportTo(409, 1096, -467, -104.6, 3.64); + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + + if (pPlayer->GetQuestRewardStatus(7487) || pPlayer->GetQuestRewardStatus(7848)) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_LR, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + + return true; } - return true; -} +}; + /*###### ## npc_zamael_lunthistle @@ -109,39 +123,46 @@ bool GossipSelect_npc_lothos_riftwaker(Player* pPlayer, Creature* /*pCreature*/, #define GOSSIP_HELLO_ZL "Tell me your story" #define GOSSIP_SELECT_ZL1 "Please continue..." #define GOSSIP_SELECT_ZL2 "Goodbye" - -bool GossipHello_npc_zamael_lunthistle(Player* pPlayer, Creature* pCreature) +
class npc_zamael_lunthistle : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); +public: + npc_zamael_lunthistle() : CreatureScript("npc_zamael_lunthistle") { } + + 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_SELECT_ZL1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + pPlayer->SEND_GOSSIP_MENU(1921, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+1: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT_ZL2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + pPlayer->SEND_GOSSIP_MENU(1922, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+2: + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->AreaExploredOrEventHappens(3377); + break; + } + return true; + } - if (pPlayer->GetQuestStatus(3377) == QUEST_STATUS_INCOMPLETE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_ZL, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - pPlayer->SEND_GOSSIP_MENU(1920, pCreature->GetGUID()); + if (pPlayer->GetQuestStatus(3377) == QUEST_STATUS_INCOMPLETE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_ZL, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - return true; -} + pPlayer->SEND_GOSSIP_MENU(1920, pCreature->GetGUID()); -bool GossipSelect_npc_zamael_lunthistle(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - switch (uiAction) - { - case GOSSIP_ACTION_INFO_DEF: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT_ZL1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - pPlayer->SEND_GOSSIP_MENU(1921, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+1: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT_ZL2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - pPlayer->SEND_GOSSIP_MENU(1922, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+2: - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->AreaExploredOrEventHappens(3377); - break; + return true; } - return true; -} + +}; + /*###### ## @@ -149,23 +170,7 @@ bool GossipSelect_npc_zamael_lunthistle(Player* pPlayer, Creature* pCreature, ui void AddSC_searing_gorge() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_kalaran_windblade"; - newscript->pGossipHello = &GossipHello_npc_kalaran_windblade; - newscript->pGossipSelect = &GossipSelect_npc_kalaran_windblade; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_lothos_riftwaker"; - newscript->pGossipHello = &GossipHello_npc_lothos_riftwaker; - newscript->pGossipSelect = &GossipSelect_npc_lothos_riftwaker; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_zamael_lunthistle"; - newscript->pGossipHello = &GossipHello_npc_zamael_lunthistle; - newscript->pGossipSelect = &GossipSelect_npc_zamael_lunthistle; - newscript->RegisterSelf(); + new npc_kalaran_windblade(); + new npc_lothos_riftwaker(); + new npc_zamael_lunthistle(); } diff --git a/src/server/scripts/EasternKingdoms/silvermoon_city.cpp b/src/server/scripts/EasternKingdoms/silvermoon_city.cpp index b636f20bb44..d05aabcd004 100644 --- a/src/server/scripts/EasternKingdoms/silvermoon_city.cpp +++ b/src/server/scripts/EasternKingdoms/silvermoon_city.cpp @@ -38,67 +38,70 @@ EndContentData */ #define QUEST_REDEEMING_THE_DEAD 9685 #define SPELL_SHIMMERING_VESSEL 31225 #define SPELL_REVIVE_SELF 32343 - -struct npc_blood_knight_stillbladeAI : public ScriptedAI +
class npc_blood_knight_stillblade : public CreatureScript { - npc_blood_knight_stillbladeAI(Creature *c) : ScriptedAI(c) {} - - uint32 lifeTimer; - bool spellHit; +public: + npc_blood_knight_stillblade() : CreatureScript("npc_blood_knight_stillblade") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - lifeTimer = 120000; - me->SetStandState(UNIT_STAND_STATE_DEAD); - me->SetUInt32Value(UNIT_FIELD_BYTES_1,7); // lay down - spellHit = false; + return new npc_blood_knight_stillbladeAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct npc_blood_knight_stillbladeAI : public ScriptedAI { - } + npc_blood_knight_stillbladeAI(Creature *c) : ScriptedAI(c) {} - void MoveInLineOfSight(Unit * /*who*/) - { - } + uint32 lifeTimer; + bool spellHit; - void UpdateAI(const uint32 diff) - { - if (me->IsStandState()) + void Reset() { - if (lifeTimer <= diff) - me->AI()->EnterEvadeMode(); - else - lifeTimer -= diff; + lifeTimer = 120000; + me->SetStandState(UNIT_STAND_STATE_DEAD); + me->SetUInt32Value(UNIT_FIELD_BYTES_1,7); // lay down + spellHit = false; } - } - void SpellHit(Unit *Hitter, const SpellEntry *Spellkind) - { - if ((Spellkind->Id == SPELL_SHIMMERING_VESSEL) && !spellHit && - (Hitter->GetTypeId() == TYPEID_PLAYER) && (CAST_PLR(Hitter)->IsActiveQuest(QUEST_REDEEMING_THE_DEAD))) + void EnterCombat(Unit * /*who*/) { - CAST_PLR(Hitter)->AreaExploredOrEventHappens(QUEST_REDEEMING_THE_DEAD); - DoCast(me, SPELL_REVIVE_SELF); - me->SetStandState(UNIT_STAND_STATE_STAND); - me->SetUInt32Value(UNIT_DYNAMIC_FLAGS, 0); - //me->RemoveAllAuras(); - DoScriptText(SAY_HEAL, me); - spellHit = true; } - } + + void MoveInLineOfSight(Unit * /*who*/) + { + } + + void UpdateAI(const uint32 diff) + { + if (me->IsStandState()) + { + if (lifeTimer <= diff) + me->AI()->EnterEvadeMode(); + else + lifeTimer -= diff; + } + } + + void SpellHit(Unit *Hitter, const SpellEntry *Spellkind) + { + if ((Spellkind->Id == SPELL_SHIMMERING_VESSEL) && !spellHit && + (Hitter->GetTypeId() == TYPEID_PLAYER) && (CAST_PLR(Hitter)->IsActiveQuest(QUEST_REDEEMING_THE_DEAD))) + { + CAST_PLR(Hitter)->AreaExploredOrEventHappens(QUEST_REDEEMING_THE_DEAD); + DoCast(me, SPELL_REVIVE_SELF); + me->SetStandState(UNIT_STAND_STATE_STAND); + me->SetUInt32Value(UNIT_DYNAMIC_FLAGS, 0); + //me->RemoveAllAuras(); + DoScriptText(SAY_HEAL, me); + spellHit = true; + } + } + }; + }; -CreatureAI* GetAI_npc_blood_knight_stillblade(Creature* pCreature) -{ - return new npc_blood_knight_stillbladeAI (pCreature); -} void AddSC_silvermoon_city() { - Script *newscript; - newscript = new Script; - newscript->Name = "npc_blood_knight_stillblade"; - newscript->GetAI = &GetAI_npc_blood_knight_stillblade; - newscript->RegisterSelf(); + new npc_blood_knight_stillblade(); } diff --git a/src/server/scripts/EasternKingdoms/silverpine_forest.cpp b/src/server/scripts/EasternKingdoms/silverpine_forest.cpp index d27155afb72..87423302abf 100644 --- a/src/server/scripts/EasternKingdoms/silverpine_forest.cpp +++ b/src/server/scripts/EasternKingdoms/silverpine_forest.cpp @@ -38,58 +38,67 @@ EndContentData */ #define GOSSIP_HAH "You're Astor Hadren, right?" #define GOSSIP_SAH "You've got something I need, Astor. And I'll be taking it now." - -struct npc_astor_hadrenAI : public ScriptedAI +
class npc_astor_hadren : public CreatureScript { - npc_astor_hadrenAI(Creature *c) : ScriptedAI(c) {} +public: + npc_astor_hadren() : CreatureScript("npc_astor_hadren") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - me->setFaction(68); + return new npc_astor_hadrenAI(pCreature); } - void EnterCombat(Unit* /*who*/) + 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_SAH, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + pPlayer->SEND_GOSSIP_MENU(624, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF + 2: + pPlayer->CLOSE_GOSSIP_MENU(); + pCreature->setFaction(21); + if (pPlayer) + CAST_AI(npc_astor_hadren::npc_astor_hadrenAI, pCreature->AI())->AttackStart(pPlayer); + break; + } + return true; } - void JustDied(Unit * /*who*/) + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - me->setFaction(68); + if (pPlayer->GetQuestStatus(1886) == QUEST_STATUS_INCOMPLETE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HAH, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + + pPlayer->SEND_GOSSIP_MENU(623, pCreature->GetGUID()); + + return true; } -}; -CreatureAI* GetAI_npc_astor_hadren(Creature* pCreature) -{ - return new npc_astor_hadrenAI(pCreature); -} + struct npc_astor_hadrenAI : public ScriptedAI + { + npc_astor_hadrenAI(Creature *c) : ScriptedAI(c) {} -bool GossipHello_npc_astor_hadren(Player* pPlayer, Creature* pCreature) -{ - if (pPlayer->GetQuestStatus(1886) == QUEST_STATUS_INCOMPLETE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HAH, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + void Reset() + { + me->setFaction(68); + } + + void EnterCombat(Unit* /*who*/) + { + } + + void JustDied(Unit * /*who*/) + { + me->setFaction(68); + } + }; + +}; - pPlayer->SEND_GOSSIP_MENU(623, pCreature->GetGUID()); - return true; -} -bool GossipSelect_npc_astor_hadren(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - switch (uiAction) - { - case GOSSIP_ACTION_INFO_DEF + 1: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SAH, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - pPlayer->SEND_GOSSIP_MENU(624, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF + 2: - pPlayer->CLOSE_GOSSIP_MENU(); - pCreature->setFaction(21); - if (pPlayer) - CAST_AI(npc_astor_hadrenAI, pCreature->AI())->AttackStart(pPlayer); - break; - } - return true; -} /*###### ## npc_deathstalker_erland @@ -116,68 +125,75 @@ enum eErland NPC_RANE = 1950, NPC_QUINN = 1951 }; - -struct npc_deathstalker_erlandAI : public npc_escortAI +
class npc_deathstalker_erland : public CreatureScript { - npc_deathstalker_erlandAI(Creature *c) : npc_escortAI(c) {} +public: + npc_deathstalker_erland() : CreatureScript("npc_deathstalker_erland") { } - void WaypointReached(uint32 i) + struct npc_deathstalker_erlandAI : public npc_escortAI { - Player* pPlayer = GetPlayerForEscort(); - - if (!pPlayer) - return; + npc_deathstalker_erlandAI(Creature *c) : npc_escortAI(c) {} - switch(i) + void WaypointReached(uint32 i) { - case 1: DoScriptText(SAY_START, me, pPlayer);break; - case 13: - DoScriptText(SAY_LAST, me, pPlayer); - pPlayer->GroupEventHappens(QUEST_ESCORTING, me); break; - case 14: DoScriptText(SAY_THANKS, me, pPlayer); break; - case 15: { - Unit* Rane = me->FindNearestCreature(NPC_RANE, 20); - if (Rane) - DoScriptText(SAY_RANE, Rane); - break;} - case 16: DoScriptText(SAY_ANSWER, me); break; - case 17: DoScriptText(SAY_MOVE_QUINN, me); break; - case 24: DoScriptText(SAY_GREETINGS, me); break; - case 25: { - Unit* Quinn = me->FindNearestCreature(NPC_QUINN, 20); - if (Quinn) - DoScriptText(SAY_QUINN, Quinn); - break;} - case 26: DoScriptText(SAY_ON_BYE, me, NULL); break; + Player* pPlayer = GetPlayerForEscort(); + if (!pPlayer) + return; + + switch(i) + { + case 1: DoScriptText(SAY_START, me, pPlayer);break; + case 13: + DoScriptText(SAY_LAST, me, pPlayer); + pPlayer->GroupEventHappens(QUEST_ESCORTING, me); break; + case 14: DoScriptText(SAY_THANKS, me, pPlayer); break; + case 15: { + Unit* Rane = me->FindNearestCreature(NPC_RANE, 20); + if (Rane) + DoScriptText(SAY_RANE, Rane); + break;} + case 16: DoScriptText(SAY_ANSWER, me); break; + case 17: DoScriptText(SAY_MOVE_QUINN, me); break; + case 24: DoScriptText(SAY_GREETINGS, me); break; + case 25: { + Unit* Quinn = me->FindNearestCreature(NPC_QUINN, 20); + if (Quinn) + DoScriptText(SAY_QUINN, Quinn); + break;} + case 26: DoScriptText(SAY_ON_BYE, me, NULL); break; + + } } - } - void Reset() {} + void Reset() {} - void EnterCombat(Unit* who) + void EnterCombat(Unit* who) + { + DoScriptText(RAND(SAY_AGGRO_1,SAY_AGGRO_2), me, who); + } + }; + + bool OnQuestAccept(Player* pPlayer, Creature* pCreature, Quest const* quest) { - DoScriptText(RAND(SAY_AGGRO_1,SAY_AGGRO_2), me, who); + if (quest->GetQuestId() == QUEST_ESCORTING) + { + DoScriptText(SAY_QUESTACCEPT, pCreature, pPlayer); + + if (npc_escortAI* pEscortAI = CAST_AI(npc_deathstalker_erland::npc_deathstalker_erlandAI, pCreature->AI())) + pEscortAI->Start(true, false, pPlayer->GetGUID()); + } + + return true; } -}; -bool QuestAccept_npc_deathstalker_erland(Player* pPlayer, Creature* pCreature, Quest const* quest) -{ - if (quest->GetQuestId() == QUEST_ESCORTING) + CreatureAI* GetAI(Creature* pCreature) const { - DoScriptText(SAY_QUESTACCEPT, pCreature, pPlayer); - - if (npc_escortAI* pEscortAI = CAST_AI(npc_deathstalker_erlandAI, pCreature->AI())) - pEscortAI->Start(true, false, pPlayer->GetGUID()); + return new npc_deathstalker_erlandAI(pCreature); } - return true; -} +}; -CreatureAI* GetAI_npc_deathstalker_erlandAI(Creature* pCreature) -{ - return new npc_deathstalker_erlandAI(pCreature); -} /*###### ## pyrewood_ambush @@ -204,159 +220,167 @@ static float PyrewoodSpawnPoints[3][4] = }; #define WAIT_SECS 6000 - -struct pyrewood_ambushAI : public ScriptedAI +
class pyrewood_ambush : public CreatureScript { - pyrewood_ambushAI(Creature *c) : ScriptedAI(c), Summons(me) - { - QuestInProgress = false; - } - - uint32 Phase; - int8 KillCount; - uint32 WaitTimer; - uint64 PlayerGUID; - SummonList Summons; +public: + pyrewood_ambush() : CreatureScript("pyrewood_ambush") { } - bool QuestInProgress; - - void Reset() + bool OnQuestAccept(Player *pPlayer, Creature *pCreature, const Quest *pQuest) { - WaitTimer = WAIT_SECS; - - if (!QuestInProgress) //fix reset values (see UpdateVictim) + if (pQuest->GetQuestId() == QUEST_PYREWOOD_AMBUSH && !CAST_AI(pyrewood_ambush::pyrewood_ambushAI, pCreature->AI())->QuestInProgress) { - Phase = 0; - KillCount = 0; - PlayerGUID = 0; - Summons.DespawnAll(); + CAST_AI(pyrewood_ambush::pyrewood_ambushAI, pCreature->AI())->QuestInProgress = true; + CAST_AI(pyrewood_ambush::pyrewood_ambushAI, pCreature->AI())->Phase = 0; + CAST_AI(pyrewood_ambush::pyrewood_ambushAI, pCreature->AI())->KillCount = 0; + CAST_AI(pyrewood_ambush::pyrewood_ambushAI, pCreature->AI())->PlayerGUID = pPlayer->GetGUID(); } - } - - void EnterCombat(Unit * /*who*/){} - void JustSummoned(Creature *pSummoned) - { - Summons.Summon(pSummoned); - ++KillCount; + return true; } - void SummonedCreatureDespawn(Creature *pSummoned) + CreatureAI* GetAI(Creature *pCreature) { - Summons.Despawn(pSummoned); - --KillCount; + return new pyrewood_ambushAI (pCreature); } - void SummonCreatureWithRandomTarget(uint32 creatureId, int position) + struct pyrewood_ambushAI : public ScriptedAI { - if (Creature *pSummoned = me->SummonCreature(creatureId, PyrewoodSpawnPoints[position][0], PyrewoodSpawnPoints[position][1], PyrewoodSpawnPoints[position][2], PyrewoodSpawnPoints[position][3], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000)) + pyrewood_ambushAI(Creature *c) : ScriptedAI(c), Summons(me) { - Player *pPlayer = NULL; - Unit *pTarget = NULL; - if (PlayerGUID) - { - pPlayer = Unit::GetPlayer(*me, PlayerGUID); - if (pPlayer) - pTarget = RAND((Unit*)me, (Unit*)pPlayer); - } else - pTarget = me; + QuestInProgress = false; + } + + uint32 Phase; + int8 KillCount; + uint32 WaitTimer; + uint64 PlayerGUID; + SummonList Summons; + + bool QuestInProgress; + + void Reset() + { + WaitTimer = WAIT_SECS; - if (pTarget) + if (!QuestInProgress) //fix reset values (see UpdateVictim) { - pSummoned->setFaction(168); - pSummoned->AddThreat(pTarget, 32.0f); - pSummoned->AI()->AttackStart(pTarget); + Phase = 0; + KillCount = 0; + PlayerGUID = 0; + Summons.DespawnAll(); } } - } - void JustDied(Unit * /*pKiller*/) - { - if (PlayerGUID) - if (Player *pPlayer = Unit::GetPlayer(*me, PlayerGUID)) - if (pPlayer->GetQuestStatus(QUEST_PYREWOOD_AMBUSH) == QUEST_STATUS_INCOMPLETE) - pPlayer->FailQuest(QUEST_PYREWOOD_AMBUSH); - } + void EnterCombat(Unit * /*who*/){} - void UpdateAI(const uint32 diff) - { - //sLog.outString("DEBUG: p(%i) k(%i) d(%u) W(%i)", Phase, KillCount, diff, WaitTimer); + void JustSummoned(Creature *pSummoned) + { + Summons.Summon(pSummoned); + ++KillCount; + } - if (!QuestInProgress) - return; + void SummonedCreatureDespawn(Creature *pSummoned) + { + Summons.Despawn(pSummoned); + --KillCount; + } - if (KillCount && Phase < 6) + void SummonCreatureWithRandomTarget(uint32 creatureId, int position) { - if (!UpdateVictim()) //reset() on target Despawn... - return; + if (Creature *pSummoned = me->SummonCreature(creatureId, PyrewoodSpawnPoints[position][0], PyrewoodSpawnPoints[position][1], PyrewoodSpawnPoints[position][2], PyrewoodSpawnPoints[position][3], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000)) + { + Player *pPlayer = NULL; + Unit *pTarget = NULL; + if (PlayerGUID) + { + pPlayer = Unit::GetPlayer(*me, PlayerGUID); + if (pPlayer) + pTarget = RAND((Unit*)me, (Unit*)pPlayer); + } else + pTarget = me; - DoMeleeAttackIfReady(); - return; + if (pTarget) + { + pSummoned->setFaction(168); + pSummoned->AddThreat(pTarget, 32.0f); + pSummoned->AI()->AttackStart(pTarget); + } + } } - switch (Phase) + void JustDied(Unit * /*pKiller*/) { - case 0: - if (WaitTimer == WAIT_SECS) - me->MonsterSay(NPCSAY_INIT, LANG_UNIVERSAL, 0); //no blizzlike + if (PlayerGUID) + if (Player *pPlayer = Unit::GetPlayer(*me, PlayerGUID)) + if (pPlayer->GetQuestStatus(QUEST_PYREWOOD_AMBUSH) == QUEST_STATUS_INCOMPLETE) + pPlayer->FailQuest(QUEST_PYREWOOD_AMBUSH); + } - if (WaitTimer <= diff) - { - WaitTimer -= diff; + void UpdateAI(const uint32 diff) + { + //sLog.outString("DEBUG: p(%i) k(%i) d(%u) W(%i)", Phase, KillCount, diff, WaitTimer); + + if (!QuestInProgress) + return; + + if (KillCount && Phase < 6) + { + if (!UpdateVictim()) //reset() on target Despawn... return; - } - break; - case 1: - SummonCreatureWithRandomTarget(2060, 1); - break; - case 2: - SummonCreatureWithRandomTarget(2061, 2); - SummonCreatureWithRandomTarget(2062, 0); - break; - case 3: - SummonCreatureWithRandomTarget(2063, 1); - SummonCreatureWithRandomTarget(2064, 2); - SummonCreatureWithRandomTarget(2065, 0); - break; - case 4: - SummonCreatureWithRandomTarget(2066, 1); - SummonCreatureWithRandomTarget(2067, 0); - SummonCreatureWithRandomTarget(2068, 2); - break; - case 5: //end - if (PlayerGUID) - { - if (Player *pPlayer = Unit::GetPlayer(*me, PlayerGUID)) + + DoMeleeAttackIfReady(); + return; + } + + switch (Phase) + { + case 0: + if (WaitTimer == WAIT_SECS) + me->MonsterSay(NPCSAY_INIT, LANG_UNIVERSAL, 0); //no blizzlike + + if (WaitTimer <= diff) { - me->MonsterSay(NPCSAY_END, LANG_UNIVERSAL, 0); //not blizzlike - pPlayer->GroupEventHappens(QUEST_PYREWOOD_AMBUSH, me); + WaitTimer -= diff; + return; } - } - QuestInProgress = false; - Reset(); - break; + break; + case 1: + SummonCreatureWithRandomTarget(2060, 1); + break; + case 2: + SummonCreatureWithRandomTarget(2061, 2); + SummonCreatureWithRandomTarget(2062, 0); + break; + case 3: + SummonCreatureWithRandomTarget(2063, 1); + SummonCreatureWithRandomTarget(2064, 2); + SummonCreatureWithRandomTarget(2065, 0); + break; + case 4: + SummonCreatureWithRandomTarget(2066, 1); + SummonCreatureWithRandomTarget(2067, 0); + SummonCreatureWithRandomTarget(2068, 2); + break; + case 5: //end + if (PlayerGUID) + { + if (Player *pPlayer = Unit::GetPlayer(*me, PlayerGUID)) + { + me->MonsterSay(NPCSAY_END, LANG_UNIVERSAL, 0); //not blizzlike + pPlayer->GroupEventHappens(QUEST_PYREWOOD_AMBUSH, me); + } + } + QuestInProgress = false; + Reset(); + break; + } + ++Phase; //prepare next phase } - ++Phase; //prepare next phase - } -}; + }; -CreatureAI* GetAI_pyrewood_ambush(Creature *pCreature) -{ - return new pyrewood_ambushAI (pCreature); -} +}; -bool QuestAccept_pyrewood_ambush(Player *pPlayer, Creature *pCreature, const Quest *pQuest) -{ - if (pQuest->GetQuestId() == QUEST_PYREWOOD_AMBUSH && !CAST_AI(pyrewood_ambushAI, pCreature->AI())->QuestInProgress) - { - CAST_AI(pyrewood_ambushAI, pCreature->AI())->QuestInProgress = true; - CAST_AI(pyrewood_ambushAI, pCreature->AI())->Phase = 0; - CAST_AI(pyrewood_ambushAI, pCreature->AI())->KillCount = 0; - CAST_AI(pyrewood_ambushAI, pCreature->AI())->PlayerGUID = pPlayer->GetGUID(); - } - return true; -} /*###### ## AddSC @@ -364,24 +388,7 @@ bool QuestAccept_pyrewood_ambush(Player *pPlayer, Creature *pCreature, const Que void AddSC_silverpine_forest() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_astor_hadren"; - newscript->pGossipHello = &GossipHello_npc_astor_hadren; - newscript->pGossipSelect = &GossipSelect_npc_astor_hadren; - newscript->GetAI = &GetAI_npc_astor_hadren; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_deathstalker_erland"; - newscript->GetAI = &GetAI_npc_deathstalker_erlandAI; - newscript->pQuestAccept = &QuestAccept_npc_deathstalker_erland; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "pyrewood_ambush"; - newscript->GetAI = &GetAI_pyrewood_ambush; - newscript->pQuestAccept = &QuestAccept_pyrewood_ambush; - newscript->RegisterSelf(); + new npc_astor_hadren(); + new npc_deathstalker_erland(); + new pyrewood_ambush(); } diff --git a/src/server/scripts/EasternKingdoms/stormwind_city.cpp b/src/server/scripts/EasternKingdoms/stormwind_city.cpp index 4553dea53a2..6ffb01f568e 100644 --- a/src/server/scripts/EasternKingdoms/stormwind_city.cpp +++ b/src/server/scripts/EasternKingdoms/stormwind_city.cpp @@ -42,30 +42,37 @@ EndContentData */ ######*/ #define GOSSIP_ITEM_MALIN "Can you send me to Theramore? I have an urgent message for Lady Jaina from Highlord Bolvar." - -bool GossipHello_npc_archmage_malin(Player* pPlayer, Creature* pCreature) +
class npc_archmage_malin : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - - if (pPlayer->GetQuestStatus(11223) == QUEST_STATUS_COMPLETE && !pPlayer->GetQuestRewardStatus(11223)) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_MALIN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); +public: + npc_archmage_malin() : CreatureScript("npc_archmage_malin") { } - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) + { + if (uiAction == GOSSIP_ACTION_INFO_DEF) + { + pPlayer->CLOSE_GOSSIP_MENU(); + pCreature->CastSpell(pPlayer, 42711, true); + } - return true; -} + return true; + } -bool GossipSelect_npc_archmage_malin(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF) + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - pPlayer->CLOSE_GOSSIP_MENU(); - pCreature->CastSpell(pPlayer, 42711, true); + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + + if (pPlayer->GetQuestStatus(11223) == QUEST_STATUS_COMPLETE && !pPlayer->GetQuestRewardStatus(11223)) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_MALIN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); + + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + + return true; } - return true; -} +}; + /*###### ## npc_bartleby @@ -76,61 +83,69 @@ enum eBartleby FACTION_ENEMY = 168, QUEST_BEAT = 1640 }; - -struct npc_bartlebyAI : public ScriptedAI +
class npc_bartleby : public CreatureScript { - npc_bartlebyAI(Creature *c) : ScriptedAI(c) +public: + npc_bartleby() : CreatureScript("npc_bartleby") { } + + bool OnQuestAccept(Player* pPlayer, Creature* pCreature, Quest const* pQuest) { - m_uiNormalFaction = c->getFaction(); + if (pQuest->GetQuestId() == QUEST_BEAT) + { + pCreature->setFaction(FACTION_ENEMY); + pCreature->AI()->AttackStart(pPlayer); + } + return true; } - uint32 m_uiNormalFaction; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - if (me->getFaction() != m_uiNormalFaction) - me->setFaction(m_uiNormalFaction); + return new npc_bartlebyAI(pCreature); } - void AttackedBy(Unit* pAttacker) + struct npc_bartlebyAI : public ScriptedAI { - if (me->getVictim()) - return; + npc_bartlebyAI(Creature *c) : ScriptedAI(c) + { + m_uiNormalFaction = c->getFaction(); + } - if (me->IsFriendlyTo(pAttacker)) - return; + uint32 m_uiNormalFaction; - AttackStart(pAttacker); - } + void Reset() + { + if (me->getFaction() != m_uiNormalFaction) + me->setFaction(m_uiNormalFaction); + } - void DamageTaken(Unit* pDoneBy, uint32 &uiDamage) - { - if (uiDamage > me->GetHealth() || ((me->GetHealth() - uiDamage)*100 / me->GetMaxHealth() < 15)) + void AttackedBy(Unit* pAttacker) { - //Take 0 damage - uiDamage = 0; + if (me->getVictim()) + return; + + if (me->IsFriendlyTo(pAttacker)) + return; - if (pDoneBy->GetTypeId() == TYPEID_PLAYER) - CAST_PLR(pDoneBy)->AreaExploredOrEventHappens(QUEST_BEAT); - EnterEvadeMode(); + AttackStart(pAttacker); } - } + + void DamageTaken(Unit* pDoneBy, uint32 &uiDamage) + { + if (uiDamage > me->GetHealth() || ((me->GetHealth() - uiDamage)*100 / me->GetMaxHealth() < 15)) + { + //Take 0 damage + uiDamage = 0; + + if (pDoneBy->GetTypeId() == TYPEID_PLAYER) + CAST_PLR(pDoneBy)->AreaExploredOrEventHappens(QUEST_BEAT); + EnterEvadeMode(); + } + } + }; + }; -bool QuestAccept_npc_bartleby(Player* pPlayer, Creature* pCreature, Quest const* pQuest) -{ - if (pQuest->GetQuestId() == QUEST_BEAT) - { - pCreature->setFaction(FACTION_ENEMY); - pCreature->AI()->AttackStart(pPlayer); - } - return true; -} -CreatureAI* GetAI_npc_bartleby(Creature* pCreature) -{ - return new npc_bartlebyAI(pCreature); -} /*###### ## npc_dashel_stonefist @@ -141,61 +156,69 @@ enum eDashel QUEST_MISSING_DIPLO_PT8 = 1447, FACTION_HOSTILE = 168 }; - -struct npc_dashel_stonefistAI : public ScriptedAI +
class npc_dashel_stonefist : public CreatureScript { - npc_dashel_stonefistAI(Creature *c) : ScriptedAI(c) +public: + npc_dashel_stonefist() : CreatureScript("npc_dashel_stonefist") { } + + bool OnQuestAccept(Player* pPlayer, Creature* pCreature, Quest const* pQuest) { - m_uiNormalFaction = c->getFaction(); + if (pQuest->GetQuestId() == QUEST_MISSING_DIPLO_PT8) + { + pCreature->setFaction(FACTION_HOSTILE); + CAST_AI(npc_dashel_stonefist::npc_dashel_stonefistAI, pCreature->AI())->AttackStart(pPlayer); + } + return true; } - uint32 m_uiNormalFaction; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - if (me->getFaction() != m_uiNormalFaction) - me->setFaction(m_uiNormalFaction); + return new npc_dashel_stonefistAI(pCreature); } - void AttackedBy(Unit* pAttacker) + struct npc_dashel_stonefistAI : public ScriptedAI { - if (me->getVictim()) - return; + npc_dashel_stonefistAI(Creature *c) : ScriptedAI(c) + { + m_uiNormalFaction = c->getFaction(); + } - if (me->IsFriendlyTo(pAttacker)) - return; + uint32 m_uiNormalFaction; - AttackStart(pAttacker); - } + void Reset() + { + if (me->getFaction() != m_uiNormalFaction) + me->setFaction(m_uiNormalFaction); + } - void DamageTaken(Unit* pDoneBy, uint32 &uiDamage) - { - if (uiDamage > me->GetHealth() || ((me->GetHealth() - uiDamage)*100 / me->GetMaxHealth() < 15)) + void AttackedBy(Unit* pAttacker) { - uiDamage = 0; + if (me->getVictim()) + return; - if (pDoneBy->GetTypeId() == TYPEID_PLAYER) - CAST_PLR(pDoneBy)->AreaExploredOrEventHappens(QUEST_MISSING_DIPLO_PT8); + if (me->IsFriendlyTo(pAttacker)) + return; - EnterEvadeMode(); + AttackStart(pAttacker); } - } + + void DamageTaken(Unit* pDoneBy, uint32 &uiDamage) + { + if (uiDamage > me->GetHealth() || ((me->GetHealth() - uiDamage)*100 / me->GetMaxHealth() < 15)) + { + uiDamage = 0; + + if (pDoneBy->GetTypeId() == TYPEID_PLAYER) + CAST_PLR(pDoneBy)->AreaExploredOrEventHappens(QUEST_MISSING_DIPLO_PT8); + + EnterEvadeMode(); + } + } + }; + }; -bool QuestAccept_npc_dashel_stonefist(Player* pPlayer, Creature* pCreature, Quest const* pQuest) -{ - if (pQuest->GetQuestId() == QUEST_MISSING_DIPLO_PT8) - { - pCreature->setFaction(FACTION_HOSTILE); - CAST_AI(npc_dashel_stonefistAI, pCreature->AI())->AttackStart(pPlayer); - } - return true; -} -CreatureAI* GetAI_npc_dashel_stonefist(Creature* pCreature) -{ - return new npc_dashel_stonefistAI(pCreature); -} /*###### ## npc_lady_katrana_prestor @@ -205,43 +228,50 @@ CreatureAI* GetAI_npc_dashel_stonefist(Creature* pCreature) #define GOSSIP_ITEM_KAT_2 "My apologies, Lady Prestor." #define GOSSIP_ITEM_KAT_3 "Begging your pardon, Lady Prestor. That was not my intent." #define GOSSIP_ITEM_KAT_4 "Thank you for your time, Lady Prestor." - -bool GossipHello_npc_lady_katrana_prestor(Player* pPlayer, Creature* pCreature) +
class npc_lady_katrana_prestor : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); +public: + npc_lady_katrana_prestor() : CreatureScript("npc_lady_katrana_prestor") { } + + 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_KAT_2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + pPlayer->SEND_GOSSIP_MENU(2694, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+1: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_KAT_3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + pPlayer->SEND_GOSSIP_MENU(2695, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+2: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_KAT_4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); + pPlayer->SEND_GOSSIP_MENU(2696, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+3: + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->AreaExploredOrEventHappens(4185); + break; + } + return true; + } - if (pPlayer->GetQuestStatus(4185) == QUEST_STATUS_INCOMPLETE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_KAT_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - pPlayer->SEND_GOSSIP_MENU(2693, pCreature->GetGUID()); + if (pPlayer->GetQuestStatus(4185) == QUEST_STATUS_INCOMPLETE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_KAT_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - return true; -} + pPlayer->SEND_GOSSIP_MENU(2693, pCreature->GetGUID()); -bool GossipSelect_npc_lady_katrana_prestor(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - switch (uiAction) - { - case GOSSIP_ACTION_INFO_DEF: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_KAT_2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - pPlayer->SEND_GOSSIP_MENU(2694, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+1: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_KAT_3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - pPlayer->SEND_GOSSIP_MENU(2695, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+2: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_KAT_4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); - pPlayer->SEND_GOSSIP_MENU(2696, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+3: - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->AreaExploredOrEventHappens(4185); - break; + return true; } - return true; -} + +}; + /*###### ## npc_lord_gregor_lescovar @@ -263,225 +293,239 @@ enum eLordGregorLescovar QUEST_THE_ATTACK = 434 }; - -struct npc_lord_gregor_lescovarAI : public npc_escortAI +
class npc_lord_gregor_lescovar : public CreatureScript { - npc_lord_gregor_lescovarAI(Creature* pCreature) : npc_escortAI(pCreature) +public: + npc_lord_gregor_lescovar() : CreatureScript("npc_lord_gregor_lescovar") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pCreature->RestoreFaction(); + return new npc_lord_gregor_lescovarAI(pCreature); } - uint32 uiTimer; - uint32 uiPhase; - - uint64 MarzonGUID; - - void Reset() + struct npc_lord_gregor_lescovarAI : public npc_escortAI { - uiTimer = 0; - uiPhase = 0; + npc_lord_gregor_lescovarAI(Creature* pCreature) : npc_escortAI(pCreature) + { + pCreature->RestoreFaction(); + } - MarzonGUID = 0; - } + uint32 uiTimer; + uint32 uiPhase; - void EnterEvadeMode() - { - me->DisappearAndDie(); + uint64 MarzonGUID; - if (Creature *pMarzon = Unit::GetCreature(*me, MarzonGUID)) + void Reset() { - if (pMarzon->isAlive()) - pMarzon->DisappearAndDie(); + uiTimer = 0; + uiPhase = 0; + + MarzonGUID = 0; } - } - void EnterCombat(Unit* pWho) - { - if (Creature *pMarzon = Unit::GetCreature(*me, MarzonGUID)) + void EnterEvadeMode() { - if (pMarzon->isAlive() && !pMarzon->isInCombat()) - pMarzon->AI()->AttackStart(pWho); + me->DisappearAndDie(); + + if (Creature *pMarzon = Unit::GetCreature(*me, MarzonGUID)) + { + if (pMarzon->isAlive()) + pMarzon->DisappearAndDie(); + } } - } - void WaypointReached(uint32 uiPointId) - { - switch(uiPointId) + void EnterCombat(Unit* pWho) { - case 14: - SetEscortPaused(true); - DoScriptText(SAY_LESCOVAR_2, me); - uiTimer = 3000; - uiPhase = 1; - break; - case 16: - SetEscortPaused(true); - if (Creature *pMarzon = me->SummonCreature(NPC_MARZON_BLADE,-8411.360352, 480.069733, 123.760895, 4.941504, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1000)) - { - pMarzon->GetMotionMaster()->MovePoint(0,-8408.000977, 468.611450, 123.759903); - MarzonGUID = pMarzon->GetGUID(); - } - uiTimer = 2000; - uiPhase = 4; - break; + if (Creature *pMarzon = Unit::GetCreature(*me, MarzonGUID)) + { + if (pMarzon->isAlive() && !pMarzon->isInCombat()) + pMarzon->AI()->AttackStart(pWho); + } } - } - //TO-DO: We don't have movemaps, also we can't make 2 npcs walks to one point propperly (and we can not use escort ai, because they are 2 different spawns and with same entry), because of it we make them, disappear. - void DoGuardsDisappearAndDie() - { - std::list<Creature*> GuardList; - me->GetCreatureListWithEntryInGrid(GuardList,NPC_STORMWIND_ROYAL,8.0f); - if (!GuardList.empty()) + + void WaypointReached(uint32 uiPointId) { - for (std::list<Creature*>::const_iterator itr = GuardList.begin(); itr != GuardList.end(); ++itr) + switch(uiPointId) { - if (Creature* pGuard = *itr) - pGuard->DisappearAndDie(); + case 14: + SetEscortPaused(true); + DoScriptText(SAY_LESCOVAR_2, me); + uiTimer = 3000; + uiPhase = 1; + break; + case 16: + SetEscortPaused(true); + if (Creature *pMarzon = me->SummonCreature(NPC_MARZON_BLADE,-8411.360352, 480.069733, 123.760895, 4.941504, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1000)) + { + pMarzon->GetMotionMaster()->MovePoint(0,-8408.000977, 468.611450, 123.759903); + MarzonGUID = pMarzon->GetGUID(); + } + uiTimer = 2000; + uiPhase = 4; + break; } } - } - - void UpdateAI(const uint32 uiDiff) - { - if (uiPhase) + //TO-DO: We don't have movemaps, also we can't make 2 npcs walks to one point propperly (and we can not use escort ai, because they are 2 different spawns and with same entry), because of it we make them, disappear. + void DoGuardsDisappearAndDie() { - if (uiTimer <= uiDiff) + std::list<Creature*> GuardList; + me->GetCreatureListWithEntryInGrid(GuardList,NPC_STORMWIND_ROYAL,8.0f); + if (!GuardList.empty()) { - switch(uiPhase) + for (std::list<Creature*>::const_iterator itr = GuardList.begin(); itr != GuardList.end(); ++itr) { - case 1: - if (Creature* pGuard = me->FindNearestCreature(NPC_STORMWIND_ROYAL, 8.0f, true)) - DoScriptText(SAY_GUARD_2, pGuard); - uiTimer = 3000; - uiPhase = 2; - break; - case 2: - DoGuardsDisappearAndDie(); - uiTimer = 2000; - uiPhase = 3; - break; - case 3: - SetEscortPaused(false); - uiTimer = 0; - uiPhase = 0; - break; - case 4: - DoScriptText(SAY_LESCOVAR_3, me); - uiTimer = 0; - uiPhase = 0; - break; - case 5: - if (Creature *pMarzon = Unit::GetCreature(*me, MarzonGUID)) - DoScriptText(SAY_MARZON_1, pMarzon); - uiTimer = 3000; - uiPhase = 6; - break; - case 6: - DoScriptText(SAY_LESCOVAR_4, me); - if (Player* pPlayer = GetPlayerForEscort()) - pPlayer->AreaExploredOrEventHappens(QUEST_THE_ATTACK); - uiTimer = 2000; - uiPhase = 7; - break; - case 7: - if (Creature* pTyrion = me->FindNearestCreature(NPC_TYRION, 20.0f, true)) - DoScriptText(SAY_TYRION_2, pTyrion); - if (Creature *pMarzon = Unit::GetCreature(*me, MarzonGUID)) - pMarzon->setFaction(14); - me->setFaction(14); - uiTimer = 0; - uiPhase = 0; - break; + if (Creature* pGuard = *itr) + pGuard->DisappearAndDie(); } - } else uiTimer -= uiDiff; + } } - npc_escortAI::UpdateAI(uiDiff); - if (!UpdateVictim()) - return; + void UpdateAI(const uint32 uiDiff) + { + if (uiPhase) + { + if (uiTimer <= uiDiff) + { + switch(uiPhase) + { + case 1: + if (Creature* pGuard = me->FindNearestCreature(NPC_STORMWIND_ROYAL, 8.0f, true)) + DoScriptText(SAY_GUARD_2, pGuard); + uiTimer = 3000; + uiPhase = 2; + break; + case 2: + DoGuardsDisappearAndDie(); + uiTimer = 2000; + uiPhase = 3; + break; + case 3: + SetEscortPaused(false); + uiTimer = 0; + uiPhase = 0; + break; + case 4: + DoScriptText(SAY_LESCOVAR_3, me); + uiTimer = 0; + uiPhase = 0; + break; + case 5: + if (Creature *pMarzon = Unit::GetCreature(*me, MarzonGUID)) + DoScriptText(SAY_MARZON_1, pMarzon); + uiTimer = 3000; + uiPhase = 6; + break; + case 6: + DoScriptText(SAY_LESCOVAR_4, me); + if (Player* pPlayer = GetPlayerForEscort()) + pPlayer->AreaExploredOrEventHappens(QUEST_THE_ATTACK); + uiTimer = 2000; + uiPhase = 7; + break; + case 7: + if (Creature* pTyrion = me->FindNearestCreature(NPC_TYRION, 20.0f, true)) + DoScriptText(SAY_TYRION_2, pTyrion); + if (Creature *pMarzon = Unit::GetCreature(*me, MarzonGUID)) + pMarzon->setFaction(14); + me->setFaction(14); + uiTimer = 0; + uiPhase = 0; + break; + } + } else uiTimer -= uiDiff; + } + npc_escortAI::UpdateAI(uiDiff); + + if (!UpdateVictim()) + return; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_npc_lord_gregor_lescovar(Creature* pCreature) -{ - return new npc_lord_gregor_lescovarAI(pCreature); -} /*###### ## npc_marzon_silent_blade ######*/ - -struct npc_marzon_silent_bladeAI : public ScriptedAI +
class npc_marzon_silent_blade : public CreatureScript { - npc_marzon_silent_bladeAI(Creature* pCreature) : ScriptedAI(pCreature) - { - me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); - } +public: + npc_marzon_silent_blade() : CreatureScript("npc_marzon_silent_blade") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - me->RestoreFaction(); + return new npc_marzon_silent_bladeAI(pCreature); } - void EnterCombat(Unit* pWho) + struct npc_marzon_silent_bladeAI : public ScriptedAI { - DoScriptText(SAY_MARZON_2, me); + npc_marzon_silent_bladeAI(Creature* pCreature) : ScriptedAI(pCreature) + { + me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + } + + void Reset() + { + me->RestoreFaction(); + } - if (me->isSummon()) + void EnterCombat(Unit* pWho) { - if (Unit* pSummoner = CAST_SUM(me)->GetSummoner()) + DoScriptText(SAY_MARZON_2, me); + + if (me->isSummon()) { - if (pSummoner && pSummoner->isAlive() && !pSummoner->isInCombat()) - CAST_CRE(pSummoner)->AI()->AttackStart(pWho); + if (Unit* pSummoner = CAST_SUM(me)->GetSummoner()) + { + if (pSummoner && pSummoner->isAlive() && !pSummoner->isInCombat()) + CAST_CRE(pSummoner)->AI()->AttackStart(pWho); + } } } - } - - void EnterEvadeMode() - { - me->DisappearAndDie(); - if (me->isSummon()) + void EnterEvadeMode() { - if (Unit* pSummoner = CAST_SUM(me)->GetSummoner()) + me->DisappearAndDie(); + + if (me->isSummon()) { - if (pSummoner && pSummoner->isAlive()) - CAST_CRE(pSummoner)->DisappearAndDie(); + if (Unit* pSummoner = CAST_SUM(me)->GetSummoner()) + { + if (pSummoner && pSummoner->isAlive()) + CAST_CRE(pSummoner)->DisappearAndDie(); + } } } - } - - void MovementInform(uint32 uiType, uint32 /*uiId*/) - { - if (uiType != POINT_MOTION_TYPE) - return; - if (me->isSummon()) + void MovementInform(uint32 uiType, uint32 /*uiId*/) { - if (Unit* pSummoner = CAST_SUM(me)->GetSummoner()) + if (uiType != POINT_MOTION_TYPE) + return; + + if (me->isSummon()) { - CAST_AI(npc_lord_gregor_lescovarAI, CAST_CRE(pSummoner)->AI())->uiTimer = 2000; - CAST_AI(npc_lord_gregor_lescovarAI, CAST_CRE(pSummoner)->AI())->uiPhase = 5; - //me->ChangeOrient(0.0f, pSummoner); + if (Unit* pSummoner = CAST_SUM(me)->GetSummoner()) + { + CAST_AI(npc_lord_gregor_lescovar::npc_lord_gregor_lescovarAI, CAST_CRE(pSummoner)->AI())->uiTimer = 2000; + CAST_AI(npc_lord_gregor_lescovar::npc_lord_gregor_lescovarAI, CAST_CRE(pSummoner)->AI())->uiPhase = 5; + //me->ChangeOrient(0.0f, pSummoner); + } } } - } - void UpdateAI(const uint32 /*diff*/) - { - if (!UpdateVictim()) - return; + void UpdateAI(const uint32 /*diff*/) + { + if (!UpdateVictim()) + return; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_npc_marzon_silent_blade(Creature* pCreature) -{ - return new npc_marzon_silent_bladeAI(pCreature); -} /*###### ## npc_tyrion_spybot @@ -501,129 +545,136 @@ enum eTyrionSpybot NPC_PRIESTESS_TYRIONA = 7779, NPC_LORD_GREGOR_LESCOVAR = 1754, }; - -struct npc_tyrion_spybotAI : public npc_escortAI +
class npc_tyrion_spybot : public CreatureScript { - npc_tyrion_spybotAI(Creature* pCreature) : npc_escortAI(pCreature) {} +public: + npc_tyrion_spybot() : CreatureScript("npc_tyrion_spybot") { } - uint32 uiTimer; - uint32 uiPhase; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - uiTimer = 0; - uiPhase = 0; + return new npc_tyrion_spybotAI(pCreature); } - void WaypointReached(uint32 uiPointId) + struct npc_tyrion_spybotAI : public npc_escortAI { - switch(uiPointId) + npc_tyrion_spybotAI(Creature* pCreature) : npc_escortAI(pCreature) {} + + uint32 uiTimer; + uint32 uiPhase; + + void Reset() { - case 1: - SetEscortPaused(true); - uiTimer = 2000; - uiPhase = 1; - break; - case 5: - SetEscortPaused(true); - DoScriptText(SAY_SPYBOT_1, me); - uiTimer = 2000; - uiPhase = 5; - break; - case 17: - SetEscortPaused(true); - DoScriptText(SAY_SPYBOT_3, me); - uiTimer = 3000; - uiPhase = 8; - break; + uiTimer = 0; + uiPhase = 0; } - } - void UpdateAI(const uint32 uiDiff) - { - if (uiPhase) + void WaypointReached(uint32 uiPointId) + { + switch(uiPointId) + { + case 1: + SetEscortPaused(true); + uiTimer = 2000; + uiPhase = 1; + break; + case 5: + SetEscortPaused(true); + DoScriptText(SAY_SPYBOT_1, me); + uiTimer = 2000; + uiPhase = 5; + break; + case 17: + SetEscortPaused(true); + DoScriptText(SAY_SPYBOT_3, me); + uiTimer = 3000; + uiPhase = 8; + break; + } + } + + void UpdateAI(const uint32 uiDiff) { - if (uiTimer <= uiDiff) + if (uiPhase) { - switch(uiPhase) + if (uiTimer <= uiDiff) { - case 1: - DoScriptText(SAY_QUEST_ACCEPT_ATTACK, me); - uiTimer = 3000; - uiPhase = 2; - break; - case 2: - if (Creature* pTyrion = me->FindNearestCreature(NPC_TYRION,10.0f)) - DoScriptText(SAY_TYRION_1, pTyrion); - uiTimer = 3000; - uiPhase = 3; - break; - case 3: - me->UpdateEntry(NPC_PRIESTESS_TYRIONA, ALLIANCE); - uiTimer = 2000; - uiPhase = 4; - break; - case 4: - SetEscortPaused(false); - uiPhase = 0; - uiTimer = 0; - break; - case 5: - if (Creature* pGuard = me->FindNearestCreature(NPC_STORMWIND_ROYAL, 10.0f, true)) - DoScriptText(SAY_GUARD_1, pGuard); - uiTimer = 3000; - uiPhase = 6; - break; - case 6: - DoScriptText(SAY_SPYBOT_2, me); - uiTimer = 3000; - uiPhase = 7; - break; - case 7: - SetEscortPaused(false); - uiTimer = 0; - uiPhase = 0; - break; - case 8: - if (Creature* pLescovar = me->FindNearestCreature(NPC_LORD_GREGOR_LESCOVAR,10.0f)) - DoScriptText(SAY_LESCOVAR_1, pLescovar); - uiTimer = 3000; - uiPhase = 9; - break; - case 9: - DoScriptText(SAY_SPYBOT_4, me); - uiTimer = 3000; - uiPhase = 10; - break; - case 10: - if (Creature* pLescovar = me->FindNearestCreature(NPC_LORD_GREGOR_LESCOVAR,10.0f)) - { - if (Player* pPlayer = GetPlayerForEscort()) + switch(uiPhase) + { + case 1: + DoScriptText(SAY_QUEST_ACCEPT_ATTACK, me); + uiTimer = 3000; + uiPhase = 2; + break; + case 2: + if (Creature* pTyrion = me->FindNearestCreature(NPC_TYRION,10.0f)) + DoScriptText(SAY_TYRION_1, pTyrion); + uiTimer = 3000; + uiPhase = 3; + break; + case 3: + me->UpdateEntry(NPC_PRIESTESS_TYRIONA, ALLIANCE); + uiTimer = 2000; + uiPhase = 4; + break; + case 4: + SetEscortPaused(false); + uiPhase = 0; + uiTimer = 0; + break; + case 5: + if (Creature* pGuard = me->FindNearestCreature(NPC_STORMWIND_ROYAL, 10.0f, true)) + DoScriptText(SAY_GUARD_1, pGuard); + uiTimer = 3000; + uiPhase = 6; + break; + case 6: + DoScriptText(SAY_SPYBOT_2, me); + uiTimer = 3000; + uiPhase = 7; + break; + case 7: + SetEscortPaused(false); + uiTimer = 0; + uiPhase = 0; + break; + case 8: + if (Creature* pLescovar = me->FindNearestCreature(NPC_LORD_GREGOR_LESCOVAR,10.0f)) + DoScriptText(SAY_LESCOVAR_1, pLescovar); + uiTimer = 3000; + uiPhase = 9; + break; + case 9: + DoScriptText(SAY_SPYBOT_4, me); + uiTimer = 3000; + uiPhase = 10; + break; + case 10: + if (Creature* pLescovar = me->FindNearestCreature(NPC_LORD_GREGOR_LESCOVAR,10.0f)) { - CAST_AI(npc_lord_gregor_lescovarAI,pLescovar->AI())->Start(false, false, pPlayer->GetGUID()); - CAST_AI(npc_lord_gregor_lescovarAI, pLescovar->AI())->SetMaxPlayerDistance(200.0f); + if (Player* pPlayer = GetPlayerForEscort()) + { + CAST_AI(npc_lord_gregor_lescovar::npc_lord_gregor_lescovarAI,pLescovar->AI())->Start(false, false, pPlayer->GetGUID()); + CAST_AI(npc_lord_gregor_lescovar::npc_lord_gregor_lescovarAI, pLescovar->AI())->SetMaxPlayerDistance(200.0f); + } } - } - me->DisappearAndDie(); - uiTimer = 0; - uiPhase = 0; - break; - } - } else uiTimer -= uiDiff; - } - npc_escortAI::UpdateAI(uiDiff); + me->DisappearAndDie(); + uiTimer = 0; + uiPhase = 0; + break; + } + } else uiTimer -= uiDiff; + } + npc_escortAI::UpdateAI(uiDiff); - if (!UpdateVictim()) - return; + if (!UpdateVictim()) + return; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_npc_tyrion_spybot(Creature* pCreature) -{ - return new npc_tyrion_spybotAI(pCreature); -} /*###### ## npc_tyrion @@ -633,66 +684,35 @@ enum eTyrion { NPC_TYRION_SPYBOT = 8856 }; - -bool QuestAccept_npc_tyrion(Player* pPlayer, Creature* pCreature, Quest const *pQuest) +
class npc_tyrion : public CreatureScript { - if (pQuest->GetQuestId() == QUEST_THE_ATTACK) +public: + npc_tyrion() : CreatureScript("npc_tyrion") { } + + bool OnQuestAccept(Player* pPlayer, Creature* pCreature, Quest const *pQuest) { - if (Creature* pSpybot = pCreature->FindNearestCreature(NPC_TYRION_SPYBOT, 5.0f, true)) + if (pQuest->GetQuestId() == QUEST_THE_ATTACK) { - CAST_AI(npc_tyrion_spybotAI,pSpybot->AI())->Start(false, false, pPlayer->GetGUID()); - CAST_AI(npc_tyrion_spybotAI,pSpybot->AI())->SetMaxPlayerDistance(200.0f); + if (Creature* pSpybot = pCreature->FindNearestCreature(NPC_TYRION_SPYBOT, 5.0f, true)) + { + CAST_AI(npc_tyrion_spybot::npc_tyrion_spybotAI,pSpybot->AI())->Start(false, false, pPlayer->GetGUID()); + CAST_AI(npc_tyrion_spybot::npc_tyrion_spybotAI,pSpybot->AI())->SetMaxPlayerDistance(200.0f); + } + return true; } - return true; + return false; } - return false; -} + +}; void AddSC_stormwind_city() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_archmage_malin"; - newscript->pGossipHello = &GossipHello_npc_archmage_malin; - newscript->pGossipSelect = &GossipSelect_npc_archmage_malin; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_bartleby"; - newscript->GetAI = &GetAI_npc_bartleby; - newscript->pQuestAccept = &QuestAccept_npc_bartleby; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_dashel_stonefist"; - newscript->GetAI = &GetAI_npc_dashel_stonefist; - newscript->pQuestAccept = &QuestAccept_npc_dashel_stonefist; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_lady_katrana_prestor"; - newscript->pGossipHello = &GossipHello_npc_lady_katrana_prestor; - newscript->pGossipSelect = &GossipSelect_npc_lady_katrana_prestor; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_tyrion"; - newscript->pQuestAccept = &QuestAccept_npc_tyrion; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_tyrion_spybot"; - newscript->GetAI = &GetAI_npc_tyrion_spybot; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_lord_gregor_lescovar"; - newscript->GetAI = &GetAI_npc_lord_gregor_lescovar; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_marzon_silent_blade"; - newscript->GetAI = &GetAI_npc_marzon_silent_blade; - newscript->RegisterSelf(); + new npc_archmage_malin(); + new npc_bartleby(); + new npc_dashel_stonefist(); + new npc_lady_katrana_prestor(); + new npc_tyrion(); + new npc_tyrion_spybot(); + new npc_lord_gregor_lescovar(); + new npc_marzon_silent_blade(); } diff --git a/src/server/scripts/EasternKingdoms/stranglethorn_vale.cpp b/src/server/scripts/EasternKingdoms/stranglethorn_vale.cpp index 503e27f993c..e25bf43669b 100644 --- a/src/server/scripts/EasternKingdoms/stranglethorn_vale.cpp +++ b/src/server/scripts/EasternKingdoms/stranglethorn_vale.cpp @@ -32,82 +32,89 @@ EndContentData */ /*###### ## mob_yenniku ######*/ - -struct mob_yennikuAI : public ScriptedAI +
class mob_yenniku : public CreatureScript { - mob_yennikuAI(Creature *c) : ScriptedAI(c) - { - bReset = false; - } - - uint32 Reset_Timer; - bool bReset; +public: + mob_yenniku() : CreatureScript("mob_yenniku") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - Reset_Timer = 0; - me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_NONE); + return new mob_yennikuAI (pCreature); } - void SpellHit(Unit *caster, const SpellEntry *spell) + struct mob_yennikuAI : public ScriptedAI { - if (caster->GetTypeId() == TYPEID_PLAYER) + mob_yennikuAI(Creature *c) : ScriptedAI(c) + { + bReset = false; + } + + uint32 Reset_Timer; + bool bReset; + + void Reset() { - //Yenniku's Release - if (!bReset && CAST_PLR(caster)->GetQuestStatus(592) == QUEST_STATUS_INCOMPLETE && spell->Id == 3607) + Reset_Timer = 0; + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_NONE); + } + + void SpellHit(Unit *caster, const SpellEntry *spell) + { + if (caster->GetTypeId() == TYPEID_PLAYER) { - me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_STUN); - me->CombatStop(); //stop combat - me->DeleteThreatList(); //unsure of this - me->setFaction(83); //horde generic + //Yenniku's Release + if (!bReset && CAST_PLR(caster)->GetQuestStatus(592) == QUEST_STATUS_INCOMPLETE && spell->Id == 3607) + { + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_STUN); + me->CombatStop(); //stop combat + me->DeleteThreatList(); //unsure of this + me->setFaction(83); //horde generic - bReset = true; - Reset_Timer = 60000; + bReset = true; + Reset_Timer = 60000; + } } + return; } - return; - } - void EnterCombat(Unit * /*who*/) {} + void EnterCombat(Unit * /*who*/) {} - void UpdateAI(const uint32 diff) - { - if (bReset) + void UpdateAI(const uint32 diff) { - if (Reset_Timer <= diff) + if (bReset) { - EnterEvadeMode(); - bReset = false; - me->setFaction(28); //troll, bloodscalp - return; - } - else Reset_Timer -= diff; + if (Reset_Timer <= diff) + { + EnterEvadeMode(); + bReset = false; + me->setFaction(28); //troll, bloodscalp + return; + } + else Reset_Timer -= diff; - if (me->isInCombat() && me->getVictim()) - { - if (me->getVictim()->GetTypeId() == TYPEID_PLAYER) + if (me->isInCombat() && me->getVictim()) { - Unit *victim = me->getVictim(); - if (CAST_PLR(victim)->GetTeam() == HORDE) + if (me->getVictim()->GetTypeId() == TYPEID_PLAYER) { - me->CombatStop(); - me->DeleteThreatList(); + Unit *victim = me->getVictim(); + if (CAST_PLR(victim)->GetTeam() == HORDE) + { + me->CombatStop(); + me->DeleteThreatList(); + } } } - } - } + } - //Return since we have no target - if (!UpdateVictim()) - return; + //Return since we have no target + if (!UpdateVictim()) + return; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_mob_yenniku(Creature* pCreature) -{ - return new mob_yennikuAI (pCreature); -} /*###### ## @@ -115,10 +122,5 @@ CreatureAI* GetAI_mob_yenniku(Creature* pCreature) void AddSC_stranglethorn_vale() { - Script *newscript; - - newscript = new Script; - newscript->Name = "mob_yenniku"; - newscript->GetAI = &GetAI_mob_yenniku; - newscript->RegisterSelf(); + new mob_yenniku(); } diff --git a/src/server/scripts/EasternKingdoms/tirisfal_glades.cpp b/src/server/scripts/EasternKingdoms/tirisfal_glades.cpp index 1f34a015f37..8dc91f7eeac 100644 --- a/src/server/scripts/EasternKingdoms/tirisfal_glades.cpp +++ b/src/server/scripts/EasternKingdoms/tirisfal_glades.cpp @@ -42,108 +42,116 @@ enum eCalvin QUEST_590 = 590, FACTION_HOSTILE = 168 }; - -struct npc_calvin_montagueAI : public ScriptedAI +
class npc_calvin_montague : public CreatureScript { - npc_calvin_montagueAI(Creature* pCreature) : ScriptedAI(pCreature) { } - - uint32 m_uiPhase; - uint32 m_uiPhaseTimer; - uint64 m_uiPlayerGUID; +public: + npc_calvin_montague() : CreatureScript("npc_calvin_montague") { } - void Reset() + bool OnQuestAccept(Player* pPlayer, Creature* pCreature, Quest const* pQuest) { - m_uiPhase = 0; - m_uiPhaseTimer = 5000; - m_uiPlayerGUID = 0; - - me->RestoreFaction(); - - if (!me->HasFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_OOC_NOT_ATTACKABLE)) - me->SetFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_OOC_NOT_ATTACKABLE); + if (pQuest->GetQuestId() == QUEST_590) + { + pCreature->setFaction(FACTION_HOSTILE); + pCreature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + CAST_AI(npc_calvin_montague::npc_calvin_montagueAI, pCreature->AI())->AttackStart(pPlayer); + } + return true; } - void EnterCombat(Unit* /*who*/) {} - - void AttackedBy(Unit* pAttacker) + CreatureAI* GetAI(Creature* pCreature) const { - if (me->getVictim() || me->IsFriendlyTo(pAttacker)) - return; - - AttackStart(pAttacker); + return new npc_calvin_montagueAI (pCreature); } - void DamageTaken(Unit* pDoneBy, uint32 &uiDamage) + struct npc_calvin_montagueAI : public ScriptedAI { - if (uiDamage > me->GetHealth() || ((me->GetHealth() - uiDamage)*100 / me->GetMaxHealth() < 15)) + npc_calvin_montagueAI(Creature* pCreature) : ScriptedAI(pCreature) { } + + uint32 m_uiPhase; + uint32 m_uiPhaseTimer; + uint64 m_uiPlayerGUID; + + void Reset() { - uiDamage = 0; + m_uiPhase = 0; + m_uiPhaseTimer = 5000; + m_uiPlayerGUID = 0; me->RestoreFaction(); - me->SetFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_OOC_NOT_ATTACKABLE); - me->CombatStop(true); - m_uiPhase = 1; + if (!me->HasFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_OOC_NOT_ATTACKABLE)) + me->SetFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_OOC_NOT_ATTACKABLE); + } + + void EnterCombat(Unit* /*who*/) {} - if (pDoneBy->GetTypeId() == TYPEID_PLAYER) - m_uiPlayerGUID = pDoneBy->GetGUID(); + void AttackedBy(Unit* pAttacker) + { + if (me->getVictim() || me->IsFriendlyTo(pAttacker)) + return; + + AttackStart(pAttacker); } - } - void UpdateAI(const uint32 uiDiff) - { - if (m_uiPhase) + void DamageTaken(Unit* pDoneBy, uint32 &uiDamage) { - if (m_uiPhaseTimer <= uiDiff) - m_uiPhaseTimer = 7500; - else + if (uiDamage > me->GetHealth() || ((me->GetHealth() - uiDamage)*100 / me->GetMaxHealth() < 15)) { - m_uiPhaseTimer -= uiDiff; - return; + uiDamage = 0; + + me->RestoreFaction(); + me->SetFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->CombatStop(true); + + m_uiPhase = 1; + + if (pDoneBy->GetTypeId() == TYPEID_PLAYER) + m_uiPlayerGUID = pDoneBy->GetGUID(); } + } - switch(m_uiPhase) + void UpdateAI(const uint32 uiDiff) + { + if (m_uiPhase) { - case 1: - DoScriptText(SAY_COMPLETE, me); - ++m_uiPhase; - break; - case 2: - if (Player *pPlayer = Unit::GetPlayer(*me, m_uiPlayerGUID)) - pPlayer->AreaExploredOrEventHappens(QUEST_590); - - DoCast(me, SPELL_DRINK, true); - ++m_uiPhase; - break; - case 3: - EnterEvadeMode(); - break; + if (m_uiPhaseTimer <= uiDiff) + m_uiPhaseTimer = 7500; + else + { + m_uiPhaseTimer -= uiDiff; + return; + } + + switch(m_uiPhase) + { + case 1: + DoScriptText(SAY_COMPLETE, me); + ++m_uiPhase; + break; + case 2: + if (Player *pPlayer = Unit::GetPlayer(*me, m_uiPlayerGUID)) + pPlayer->AreaExploredOrEventHappens(QUEST_590); + + DoCast(me, SPELL_DRINK, true); + ++m_uiPhase; + break; + case 3: + EnterEvadeMode(); + break; + } + + return; } - return; - } + if (!UpdateVictim()) + return; - if (!UpdateVictim()) - return; + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_npc_calvin_montague(Creature* pCreature) -{ - return new npc_calvin_montagueAI (pCreature); -} -bool QuestAccept_npc_calvin_montague(Player* pPlayer, Creature* pCreature, Quest const* pQuest) -{ - if (pQuest->GetQuestId() == QUEST_590) - { - pCreature->setFaction(FACTION_HOSTILE); - pCreature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); - CAST_AI(npc_calvin_montagueAI, pCreature->AI())->AttackStart(pPlayer); - } - return true; -} /*###### ## go_mausoleum_door @@ -157,54 +165,52 @@ enum eMausoleum GO_TRIGGER = 104593, GO_DOOR = 176594 }; - -bool GOHello_go_mausoleum_door(Player* pPlayer, GameObject* /*pGo*/) +
class go_mausoleum_door : public GameObjectScript { - if (pPlayer->GetQuestStatus(QUEST_ULAG) != QUEST_STATUS_INCOMPLETE) - return false; +public: + go_mausoleum_door() : GameObjectScript("go_mausoleum_door") { } - if (GameObject* pTrigger = pPlayer->FindNearestGameObject(GO_TRIGGER, 30.0f)) + bool OnGossipHello(Player* pPlayer, GameObject* /*pGo*/) { - pTrigger->SetGoState(GO_STATE_READY); - pPlayer->SummonCreature(NPC_ULAG, 2390.26, 336.47, 40.01, 2.26, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 300000); + if (pPlayer->GetQuestStatus(QUEST_ULAG) != QUEST_STATUS_INCOMPLETE) + return false; + + if (GameObject* pTrigger = pPlayer->FindNearestGameObject(GO_TRIGGER, 30.0f)) + { + pTrigger->SetGoState(GO_STATE_READY); + pPlayer->SummonCreature(NPC_ULAG, 2390.26, 336.47, 40.01, 2.26, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 300000); + return false; + } + return false; } - return false; -} - -bool GOHello_go_mausoleum_trigger(Player* pPlayer, GameObject* pGo) +}; +
class go_mausoleum_trigger : public GameObjectScript { - if (pPlayer->GetQuestStatus(QUEST_ULAG) != QUEST_STATUS_INCOMPLETE) - return false; +public: + go_mausoleum_trigger() : GameObjectScript("go_mausoleum_trigger") { } - if (GameObject* pDoor = pPlayer->FindNearestGameObject(GO_DOOR, 30.0f)) + bool OnGossipHello(Player* pPlayer, GameObject* pGo) { - pGo->SetGoState(GO_STATE_ACTIVE); - pDoor->RemoveFlag(GAMEOBJECT_FLAGS,GO_FLAG_INTERACT_COND); - return true; + if (pPlayer->GetQuestStatus(QUEST_ULAG) != QUEST_STATUS_INCOMPLETE) + return false; + + if (GameObject* pDoor = pPlayer->FindNearestGameObject(GO_DOOR, 30.0f)) + { + pGo->SetGoState(GO_STATE_ACTIVE); + pDoor->RemoveFlag(GAMEOBJECT_FLAGS,GO_FLAG_INTERACT_COND); + return true; + } + + return false; } - return false; -} +}; void AddSC_tirisfal_glades() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_calvin_montague"; - newscript->GetAI = &GetAI_npc_calvin_montague; - newscript->pQuestAccept = &QuestAccept_npc_calvin_montague; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "go_mausoleum_door"; - newscript->pGOHello = &GOHello_go_mausoleum_door; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "go_mausoleum_trigger"; - newscript->pGOHello = &GOHello_go_mausoleum_trigger; - newscript->RegisterSelf(); + new npc_calvin_montague(); + new go_mausoleum_door(); + new go_mausoleum_trigger(); } diff --git a/src/server/scripts/EasternKingdoms/undercity.cpp b/src/server/scripts/EasternKingdoms/undercity.cpp index 017dab5b63d..7d3e831be1c 100644 --- a/src/server/scripts/EasternKingdoms/undercity.cpp +++ b/src/server/scripts/EasternKingdoms/undercity.cpp @@ -56,133 +56,148 @@ float HighborneLoc[4][3]= #define HIGHBORNE_LOC_Y -61.00 #define HIGHBORNE_LOC_Y_NEW -55.50 - -struct npc_lady_sylvanas_windrunnerAI : public ScriptedAI +
class npc_lady_sylvanas_windrunner : public CreatureScript { - npc_lady_sylvanas_windrunnerAI(Creature *c) : ScriptedAI(c) {} - - uint32 LamentEvent_Timer; - bool LamentEvent; - uint64 targetGUID; +public: + npc_lady_sylvanas_windrunner() : CreatureScript("npc_lady_sylvanas_windrunner") { } - void Reset() + bool ChooseReward(Player* /*pPlayer*/, Creature* pCreature, const Quest *_Quest, uint32 /*slot*/) { - LamentEvent_Timer = 5000; - LamentEvent = false; - targetGUID = 0; + if (_Quest->GetQuestId() == 9180) + { + CAST_AI(npc_lady_sylvanas_windrunner::npc_lady_sylvanas_windrunnerAI, pCreature->AI())->LamentEvent = true; + CAST_AI(npc_lady_sylvanas_windrunner::npc_lady_sylvanas_windrunnerAI, pCreature->AI())->DoPlaySoundToSet(pCreature,SOUND_CREDIT); + pCreature->CastSpell(pCreature,SPELL_SYLVANAS_CAST,false); + + for (uint8 i = 0; i < 4; ++i) + pCreature->SummonCreature(ENTRY_HIGHBORNE_LAMENTER, HighborneLoc[i][0], HighborneLoc[i][1], HIGHBORNE_LOC_Y, HighborneLoc[i][2], TEMPSUMMON_TIMED_DESPAWN, 160000); + } + + return true; } - void EnterCombat(Unit * /*who*/) {} + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_lady_sylvanas_windrunnerAI (pCreature); + } - void JustSummoned(Creature *summoned) + struct npc_lady_sylvanas_windrunnerAI : public ScriptedAI { - if (summoned->GetEntry() == ENTRY_HIGHBORNE_BUNNY) - { - if (Unit *pTarget = Unit::GetUnit(*summoned,targetGUID)) - { - pTarget->SendMonsterMove(pTarget->GetPositionX(), pTarget->GetPositionY(), me->GetPositionZ()+15.0,0); - pTarget->GetMap()->CreatureRelocation(me, pTarget->GetPositionX(), pTarget->GetPositionY(), me->GetPositionZ()+15.0, 0.0f); - summoned->CastSpell(pTarget, SPELL_RIBBON_OF_SOULS, false); - } + npc_lady_sylvanas_windrunnerAI(Creature *c) : ScriptedAI(c) {} - summoned->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); - targetGUID = summoned->GetGUID(); + uint32 LamentEvent_Timer; + bool LamentEvent; + uint64 targetGUID; + + void Reset() + { + LamentEvent_Timer = 5000; + LamentEvent = false; + targetGUID = 0; } - } - void UpdateAI(const uint32 diff) - { - if (LamentEvent) + void EnterCombat(Unit * /*who*/) {} + + void JustSummoned(Creature *summoned) { - if (LamentEvent_Timer <= diff) + if (summoned->GetEntry() == ENTRY_HIGHBORNE_BUNNY) { - DoSummon(ENTRY_HIGHBORNE_BUNNY, me, 10.0f, 3000, TEMPSUMMON_TIMED_DESPAWN); - - LamentEvent_Timer = 2000; - if (!me->HasAura(SPELL_SYLVANAS_CAST)) + if (Unit *pTarget = Unit::GetUnit(*summoned,targetGUID)) { - DoScriptText(SAY_LAMENT_END, me); - DoScriptText(EMOTE_LAMENT_END, me); - LamentEvent = false; + pTarget->SendMonsterMove(pTarget->GetPositionX(), pTarget->GetPositionY(), me->GetPositionZ()+15.0,0); + pTarget->GetMap()->CreatureRelocation(me, pTarget->GetPositionX(), pTarget->GetPositionY(), me->GetPositionZ()+15.0, 0.0f); + summoned->CastSpell(pTarget, SPELL_RIBBON_OF_SOULS, false); } - } else LamentEvent_Timer -= diff; + + summoned->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + targetGUID = summoned->GetGUID(); + } } - if (!UpdateVictim()) - return; + void UpdateAI(const uint32 diff) + { + if (LamentEvent) + { + if (LamentEvent_Timer <= diff) + { + DoSummon(ENTRY_HIGHBORNE_BUNNY, me, 10.0f, 3000, TEMPSUMMON_TIMED_DESPAWN); + + LamentEvent_Timer = 2000; + if (!me->HasAura(SPELL_SYLVANAS_CAST)) + { + DoScriptText(SAY_LAMENT_END, me); + DoScriptText(EMOTE_LAMENT_END, me); + LamentEvent = false; + } + } else LamentEvent_Timer -= diff; + } - DoMeleeAttackIfReady(); - } -}; -CreatureAI* GetAI_npc_lady_sylvanas_windrunner(Creature* pCreature) -{ - return new npc_lady_sylvanas_windrunnerAI (pCreature); -} + if (!UpdateVictim()) + return; -bool ChooseReward_npc_lady_sylvanas_windrunner(Player* /*pPlayer*/, Creature* pCreature, const Quest *_Quest, uint32 /*slot*/) -{ - if (_Quest->GetQuestId() == 9180) - { - CAST_AI(npc_lady_sylvanas_windrunnerAI, pCreature->AI())->LamentEvent = true; - CAST_AI(npc_lady_sylvanas_windrunnerAI, pCreature->AI())->DoPlaySoundToSet(pCreature,SOUND_CREDIT); - pCreature->CastSpell(pCreature,SPELL_SYLVANAS_CAST,false); + DoMeleeAttackIfReady(); + } + }; - for (uint8 i = 0; i < 4; ++i) - pCreature->SummonCreature(ENTRY_HIGHBORNE_LAMENTER, HighborneLoc[i][0], HighborneLoc[i][1], HIGHBORNE_LOC_Y, HighborneLoc[i][2], TEMPSUMMON_TIMED_DESPAWN, 160000); - } +}; - return true; -} /*###### ## npc_highborne_lamenter ######*/ - -struct npc_highborne_lamenterAI : public ScriptedAI +
class npc_highborne_lamenter : public CreatureScript { - npc_highborne_lamenterAI(Creature *c) : ScriptedAI(c) {} +public: + npc_highborne_lamenter() : CreatureScript("npc_highborne_lamenter") { } - uint32 EventMove_Timer; - uint32 EventCast_Timer; - bool EventMove; - bool EventCast; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - EventMove_Timer = 10000; - EventCast_Timer = 17500; - EventMove = true; - EventCast = true; + return new npc_highborne_lamenterAI (pCreature); } - void EnterCombat(Unit * /*who*/) {} - - void UpdateAI(const uint32 diff) + struct npc_highborne_lamenterAI : public ScriptedAI { - if (EventMove) + npc_highborne_lamenterAI(Creature *c) : ScriptedAI(c) {} + + uint32 EventMove_Timer; + uint32 EventCast_Timer; + bool EventMove; + bool EventCast; + + void Reset() { - if (EventMove_Timer <= diff) - { - me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); - me->SendMonsterMoveWithSpeed(me->GetPositionX(),me->GetPositionY(),HIGHBORNE_LOC_Y_NEW,5000); - me->GetMap()->CreatureRelocation(me,me->GetPositionX(),me->GetPositionY(),HIGHBORNE_LOC_Y_NEW,me->GetOrientation()); - EventMove = false; - } else EventMove_Timer -= diff; + EventMove_Timer = 10000; + EventCast_Timer = 17500; + EventMove = true; + EventCast = true; } - if (EventCast) + + void EnterCombat(Unit * /*who*/) {} + + void UpdateAI(const uint32 diff) { - if (EventCast_Timer <= diff) + if (EventMove) { - DoCast(me, SPELL_HIGHBORNE_AURA); - EventCast = false; - } else EventCast_Timer -= diff; + if (EventMove_Timer <= diff) + { + me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + me->SendMonsterMoveWithSpeed(me->GetPositionX(),me->GetPositionY(),HIGHBORNE_LOC_Y_NEW,5000); + me->GetMap()->CreatureRelocation(me,me->GetPositionX(),me->GetPositionY(),HIGHBORNE_LOC_Y_NEW,me->GetOrientation()); + EventMove = false; + } else EventMove_Timer -= diff; + } + if (EventCast) + { + if (EventCast_Timer <= diff) + { + DoCast(me, SPELL_HIGHBORNE_AURA); + EventCast = false; + } else EventCast_Timer -= diff; + } } - } + }; + }; -CreatureAI* GetAI_npc_highborne_lamenter(Creature* pCreature) -{ - return new npc_highborne_lamenterAI (pCreature); -} /*###### ## npc_parqual_fintallas @@ -193,39 +208,46 @@ CreatureAI* GetAI_npc_highborne_lamenter(Creature* pCreature) #define GOSSIP_HPF1 "Gul'dan" #define GOSSIP_HPF2 "Kel'Thuzad" #define GOSSIP_HPF3 "Ner'zhul" - -bool GossipHello_npc_parqual_fintallas(Player* pPlayer, Creature* pCreature) +
class npc_parqual_fintallas : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); +public: + npc_parqual_fintallas() : CreatureScript("npc_parqual_fintallas") { } - if (pPlayer->GetQuestStatus(6628) == QUEST_STATUS_INCOMPLETE && !pPlayer->HasAura(SPELL_MARK_OF_SHAME)) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HPF1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HPF2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HPF3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); - pPlayer->SEND_GOSSIP_MENU(5822, pCreature->GetGUID()); + if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + { + pPlayer->CLOSE_GOSSIP_MENU(); + pCreature->CastSpell(pPlayer,SPELL_MARK_OF_SHAME,false); + } + if (uiAction == GOSSIP_ACTION_INFO_DEF+2) + { + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->AreaExploredOrEventHappens(6628); + } + return true; } - else - pPlayer->SEND_GOSSIP_MENU(5821, pCreature->GetGUID()); - return true; -} - -bool GossipSelect_npc_parqual_fintallas(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) - { - pPlayer->CLOSE_GOSSIP_MENU(); - pCreature->CastSpell(pPlayer,SPELL_MARK_OF_SHAME,false); - } - if (uiAction == GOSSIP_ACTION_INFO_DEF+2) + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->AreaExploredOrEventHappens(6628); + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + + if (pPlayer->GetQuestStatus(6628) == QUEST_STATUS_INCOMPLETE && !pPlayer->HasAura(SPELL_MARK_OF_SHAME)) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HPF1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HPF2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HPF3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); + pPlayer->SEND_GOSSIP_MENU(5822, pCreature->GetGUID()); + } + else + pPlayer->SEND_GOSSIP_MENU(5821, pCreature->GetGUID()); + + return true; } - return true; -} + +}; + /*###### ## AddSC @@ -233,22 +255,7 @@ bool GossipSelect_npc_parqual_fintallas(Player* pPlayer, Creature* pCreature, ui void AddSC_undercity() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_lady_sylvanas_windrunner"; - newscript->GetAI = &GetAI_npc_lady_sylvanas_windrunner; - newscript->pChooseReward = &ChooseReward_npc_lady_sylvanas_windrunner; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_highborne_lamenter"; - newscript->GetAI = &GetAI_npc_highborne_lamenter; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_parqual_fintallas"; - newscript->pGossipHello = &GossipHello_npc_parqual_fintallas; - newscript->pGossipSelect = &GossipSelect_npc_parqual_fintallas; - newscript->RegisterSelf(); + new npc_lady_sylvanas_windrunner(); + new npc_highborne_lamenter(); + new npc_parqual_fintallas(); } diff --git a/src/server/scripts/EasternKingdoms/western_plaguelands.cpp b/src/server/scripts/EasternKingdoms/western_plaguelands.cpp index 3dddf3a3f80..9950955fd44 100644 --- a/src/server/scripts/EasternKingdoms/western_plaguelands.cpp +++ b/src/server/scripts/EasternKingdoms/western_plaguelands.cpp @@ -43,57 +43,64 @@ EndContentData */ #define GOSSIP_HDA4 "What does the Gahrron's Withering Cauldron need?" #define GOSSIP_SDA1 "Thanks, i need a Vitreous Focuser" - -bool GossipHello_npcs_dithers_and_arbington(Player* pPlayer, Creature* pCreature) +
class npcs_dithers_and_arbington : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if (pCreature->isVendor()) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); +public: + npcs_dithers_and_arbington() : CreatureScript("npcs_dithers_and_arbington") { } - if (pPlayer->GetQuestRewardStatus(5237) || pPlayer->GetQuestRewardStatus(5238)) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HDA1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HDA2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HDA3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HDA4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4); - pPlayer->SEND_GOSSIP_MENU(3985, pCreature->GetGUID()); - }else - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - - return true; -} + switch(uiAction) + { + case GOSSIP_ACTION_TRADE: + pPlayer->SEND_VENDORLIST(pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+1: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SDA1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5); + pPlayer->SEND_GOSSIP_MENU(3980, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+2: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SDA1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5); + pPlayer->SEND_GOSSIP_MENU(3981, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+3: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SDA1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5); + pPlayer->SEND_GOSSIP_MENU(3982, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+4: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SDA1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5); + pPlayer->SEND_GOSSIP_MENU(3983, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+5: + pPlayer->CLOSE_GOSSIP_MENU(); + pCreature->CastSpell(pPlayer, 17529, false); + break; + } + return true; + } -bool GossipSelect_npcs_dithers_and_arbington(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - switch(uiAction) + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - case GOSSIP_ACTION_TRADE: - pPlayer->SEND_VENDORLIST(pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+1: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SDA1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5); - pPlayer->SEND_GOSSIP_MENU(3980, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+2: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SDA1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5); - pPlayer->SEND_GOSSIP_MENU(3981, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+3: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SDA1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5); - pPlayer->SEND_GOSSIP_MENU(3982, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+4: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SDA1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5); - pPlayer->SEND_GOSSIP_MENU(3983, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+5: - pPlayer->CLOSE_GOSSIP_MENU(); - pCreature->CastSpell(pPlayer, 17529, false); - break; + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + if (pCreature->isVendor()) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); + + if (pPlayer->GetQuestRewardStatus(5237) || pPlayer->GetQuestRewardStatus(5238)) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HDA1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HDA2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HDA3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HDA4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4); + pPlayer->SEND_GOSSIP_MENU(3985, pCreature->GetGUID()); + }else + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + + return true; } - return true; -} + +}; + /*###### ## npc_myranda_the_hag @@ -107,106 +114,120 @@ enum eMyranda }; #define GOSSIP_ITEM_ILLUSION "I am ready for the illusion, Myranda." - -bool GossipHello_npc_myranda_the_hag(Player* pPlayer, Creature* pCreature) +
class npc_myranda_the_hag : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); +public: + npc_myranda_the_hag() : CreatureScript("npc_myranda_the_hag") { } - if (pPlayer->GetQuestStatus(QUEST_SUBTERFUGE) == QUEST_STATUS_COMPLETE && - !pPlayer->GetQuestRewardStatus(QUEST_IN_DREAMS) && !pPlayer->HasAura(SPELL_SCARLET_ILLUSION)) + bool OnGossipSelect(Player* pPlayer, Creature* /*pCreature*/, uint32 /*uiSender*/, uint32 uiAction) { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ILLUSION, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - pPlayer->SEND_GOSSIP_MENU(4773, pCreature->GetGUID()); + if (uiAction == GOSSIP_ACTION_INFO_DEF + 1) + { + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->CastSpell(pPlayer, SPELL_SCARLET_ILLUSION, false); + } return true; } - else - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - return true; -} - -bool GossipSelect_npc_myranda_the_hag(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(); - pPlayer->CastSpell(pPlayer, SPELL_SCARLET_ILLUSION, false); + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + + if (pPlayer->GetQuestStatus(QUEST_SUBTERFUGE) == QUEST_STATUS_COMPLETE && + !pPlayer->GetQuestRewardStatus(QUEST_IN_DREAMS) && !pPlayer->HasAura(SPELL_SCARLET_ILLUSION)) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ILLUSION, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + pPlayer->SEND_GOSSIP_MENU(4773, pCreature->GetGUID()); + return true; + } + else + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + + return true; } - return true; -} + +}; + /*###### ## npc_the_scourge_cauldron ######*/ - -struct npc_the_scourge_cauldronAI : public ScriptedAI +
class npc_the_scourge_cauldron : public CreatureScript { - npc_the_scourge_cauldronAI(Creature *c) : ScriptedAI(c) {} - - void Reset() {} +public: + npc_the_scourge_cauldron() : CreatureScript("npc_the_scourge_cauldron") { } - void EnterCombat(Unit* /*who*/) {} - - void DoDie() + CreatureAI* GetAI(Creature* pCreature) const { - //summoner dies here - me->DealDamage(me, me->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); - //override any database `spawntimesecs` to prevent duplicated summons - uint32 rTime = me->GetRespawnDelay(); - if (rTime<600) - me->SetRespawnDelay(600); + return new npc_the_scourge_cauldronAI (pCreature); } - void MoveInLineOfSight(Unit *who) + struct npc_the_scourge_cauldronAI : public ScriptedAI { - if (!who || who->GetTypeId() != TYPEID_PLAYER) - return; + npc_the_scourge_cauldronAI(Creature *c) : ScriptedAI(c) {} + + void Reset() {} + + void EnterCombat(Unit* /*who*/) {} - if (who->GetTypeId() == TYPEID_PLAYER) + void DoDie() { - switch(me->GetAreaId()) + //summoner dies here + me->DealDamage(me, me->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + //override any database `spawntimesecs` to prevent duplicated summons + uint32 rTime = me->GetRespawnDelay(); + if (rTime<600) + me->SetRespawnDelay(600); + } + + void MoveInLineOfSight(Unit *who) + { + if (!who || who->GetTypeId() != TYPEID_PLAYER) + return; + + if (who->GetTypeId() == TYPEID_PLAYER) { - case 199: //felstone - if (CAST_PLR(who)->GetQuestStatus(5216) == QUEST_STATUS_INCOMPLETE || - CAST_PLR(who)->GetQuestStatus(5229) == QUEST_STATUS_INCOMPLETE) - { - me->SummonCreature(11075, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 600000); - DoDie(); - } - break; - case 200: //dalson - if (CAST_PLR(who)->GetQuestStatus(5219) == QUEST_STATUS_INCOMPLETE || - CAST_PLR(who)->GetQuestStatus(5231) == QUEST_STATUS_INCOMPLETE) - { - me->SummonCreature(11077, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 600000); - DoDie(); - } - break; - case 201: //gahrron - if (CAST_PLR(who)->GetQuestStatus(5225) == QUEST_STATUS_INCOMPLETE || - CAST_PLR(who)->GetQuestStatus(5235) == QUEST_STATUS_INCOMPLETE) - { - me->SummonCreature(11078, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,600000); - DoDie(); - } - break; - case 202: //writhing - if (CAST_PLR(who)->GetQuestStatus(5222) == QUEST_STATUS_INCOMPLETE || - CAST_PLR(who)->GetQuestStatus(5233) == QUEST_STATUS_INCOMPLETE) - { - me->SummonCreature(11076, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,600000); - DoDie(); - } - break; + switch(me->GetAreaId()) + { + case 199: //felstone + if (CAST_PLR(who)->GetQuestStatus(5216) == QUEST_STATUS_INCOMPLETE || + CAST_PLR(who)->GetQuestStatus(5229) == QUEST_STATUS_INCOMPLETE) + { + me->SummonCreature(11075, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 600000); + DoDie(); + } + break; + case 200: //dalson + if (CAST_PLR(who)->GetQuestStatus(5219) == QUEST_STATUS_INCOMPLETE || + CAST_PLR(who)->GetQuestStatus(5231) == QUEST_STATUS_INCOMPLETE) + { + me->SummonCreature(11077, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 600000); + DoDie(); + } + break; + case 201: //gahrron + if (CAST_PLR(who)->GetQuestStatus(5225) == QUEST_STATUS_INCOMPLETE || + CAST_PLR(who)->GetQuestStatus(5235) == QUEST_STATUS_INCOMPLETE) + { + me->SummonCreature(11078, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,600000); + DoDie(); + } + break; + case 202: //writhing + if (CAST_PLR(who)->GetQuestStatus(5222) == QUEST_STATUS_INCOMPLETE || + CAST_PLR(who)->GetQuestStatus(5233) == QUEST_STATUS_INCOMPLETE) + { + me->SummonCreature(11076, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,600000); + DoDie(); + } + break; + } } } - } + }; + }; -CreatureAI* GetAI_npc_the_scourge_cauldron(Creature* pCreature) -{ - return new npc_the_scourge_cauldronAI (pCreature); -} /*###### ## npcs_andorhal_tower @@ -216,25 +237,32 @@ enum eAndorhalTower { GO_BEACON_TORCH = 176093 }; - -struct npc_andorhal_towerAI : public Scripted_NoMovementAI +
class npc_andorhal_tower : public CreatureScript { - npc_andorhal_towerAI(Creature *c) : Scripted_NoMovementAI(c) {} +public: + npc_andorhal_tower() : CreatureScript("npc_andorhal_tower") { } - void MoveInLineOfSight(Unit* pWho) + CreatureAI* GetAI(Creature* pCreature) const { - if (!pWho || pWho->GetTypeId() != TYPEID_PLAYER) - return; - - if (me->FindNearestGameObject(GO_BEACON_TORCH, 10.0f)) - CAST_PLR(pWho)->KilledMonsterCredit(me->GetEntry(), me->GetGUID()); + return new npc_andorhal_towerAI (pCreature); } + + struct npc_andorhal_towerAI : public Scripted_NoMovementAI + { + npc_andorhal_towerAI(Creature *c) : Scripted_NoMovementAI(c) {} + + void MoveInLineOfSight(Unit* pWho) + { + if (!pWho || pWho->GetTypeId() != TYPEID_PLAYER) + return; + + if (me->FindNearestGameObject(GO_BEACON_TORCH, 10.0f)) + CAST_PLR(pWho)->KilledMonsterCredit(me->GetEntry(), me->GetGUID()); + } + }; + }; -CreatureAI* GetAI_npc_andorhal_tower(Creature* pCreature) -{ - return new npc_andorhal_towerAI (pCreature); -} /*###### ## npc_anchorite_truuen @@ -256,109 +284,117 @@ enum eTruuen SAY_WP_5 = -1999986, //Please, rise my friend. Keep the Blessing as a symbol of the strength of the Light and how heroes long gone might once again rise in each of us to inspire. SAY_WP_6 = -1999987 //Thank you my friend for making this possible. This is a day that I shall never forget! I think I will stay a while. Please return to High Priestess MacDonnell at the camp. I know that she'll be keenly interested to know of what has transpired here. }; +
class npc_anchorite_truuen : public CreatureScript +{ +public: + npc_anchorite_truuen() : CreatureScript("npc_anchorite_truuen") { } -struct npc_anchorite_truuenAI : public npc_escortAI -{ - npc_anchorite_truuenAI(Creature* pCreature) : npc_escortAI(pCreature) { } - - uint32 m_uiChatTimer; - - uint64 UghostGUID; - uint64 TheldanisGUID; - - Creature* Ughost; - Creature* Theldanis; + bool OnQuestAccept(Player* pPlayer, Creature* pCreature, Quest const *quest) + { + npc_escortAI* pEscortAI = CAST_AI(npc_anchorite_truuen::npc_anchorite_truuenAI, pCreature->AI()); - void Reset() - { - m_uiChatTimer = 7000; + if (quest->GetQuestId() == QUEST_TOMB_LIGHTBRINGER) + pEscortAI->Start(true, true, pPlayer->GetGUID()); + return false; } - void JustSummoned(Creature* pSummoned) + CreatureAI* GetAI(Creature* pCreature) const { - if (pSummoned->GetEntry() == NPC_GHOUL) - pSummoned->AI()->AttackStart(me); + return new npc_anchorite_truuenAI(pCreature); } - - void WaypointReached(uint32 i) + + struct npc_anchorite_truuenAI : public npc_escortAI { - Player* pPlayer = GetPlayerForEscort(); - switch (i) + npc_anchorite_truuenAI(Creature* pCreature) : npc_escortAI(pCreature) { } + + uint32 m_uiChatTimer; + + uint64 UghostGUID; + uint64 TheldanisGUID; + + Creature* Ughost; + Creature* Theldanis; + + void Reset() + { + m_uiChatTimer = 7000; + } + + void JustSummoned(Creature* pSummoned) { - case 8: - DoScriptText(SAY_WP_0, me); - me->SummonCreature(NPC_GHOUL, me->GetPositionX()+7.0f, me->GetPositionY()+7.0f, me->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 90000); - me->SummonCreature(NPC_GHOUL, me->GetPositionX()+5.0f, me->GetPositionY()+5.0f, me->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 90000); - break; - case 9: - DoScriptText(SAY_WP_1, me); - break; - case 14: - me->SummonCreature(NPC_GHOUL, me->GetPositionX()+7.0f, me->GetPositionY()+7.0f, me->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 90000); - me->SummonCreature(NPC_GHOUL, me->GetPositionX()+5.0f, me->GetPositionY()+5.0f, me->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 90000); - me->SummonCreature(NPC_GHOUL, me->GetPositionX()+10.0f, me->GetPositionY()+10.0f, me->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 90000); - me->SummonCreature(NPC_GHOUL, me->GetPositionX()+8.0f, me->GetPositionY()+8.0f, me->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 90000); - break; - case 15: - DoScriptText(SAY_WP_2, me); - case 21: - Theldanis = GetClosestCreatureWithEntry(me, NPC_THEL_DANIS, 150); - DoScriptText(SAY_WP_3, Theldanis); - break; - case 22: - break; - case 23: - Ughost = me->SummonCreature(NPC_GHOST_UTHER, 971.86,-1825.42 ,81.99 , 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - Ughost->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); - DoScriptText(SAY_WP_4, Ughost, me); - m_uiChatTimer = 4000; - break; - case 24: - DoScriptText(SAY_WP_5, Ughost, me); - m_uiChatTimer = 4000; - break; - case 25: - DoScriptText(SAY_WP_6, Ughost, me); - m_uiChatTimer = 4000; - break; - case 26: - if (pPlayer) - pPlayer->GroupEventHappens(QUEST_TOMB_LIGHTBRINGER, me); - break; + if (pSummoned->GetEntry() == NPC_GHOUL) + pSummoned->AI()->AttackStart(me); + } + + void WaypointReached(uint32 i) + { + Player* pPlayer = GetPlayerForEscort(); + switch (i) + { + case 8: + DoScriptText(SAY_WP_0, me); + me->SummonCreature(NPC_GHOUL, me->GetPositionX()+7.0f, me->GetPositionY()+7.0f, me->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 90000); + me->SummonCreature(NPC_GHOUL, me->GetPositionX()+5.0f, me->GetPositionY()+5.0f, me->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 90000); + break; + case 9: + DoScriptText(SAY_WP_1, me); + break; + case 14: + me->SummonCreature(NPC_GHOUL, me->GetPositionX()+7.0f, me->GetPositionY()+7.0f, me->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 90000); + me->SummonCreature(NPC_GHOUL, me->GetPositionX()+5.0f, me->GetPositionY()+5.0f, me->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 90000); + me->SummonCreature(NPC_GHOUL, me->GetPositionX()+10.0f, me->GetPositionY()+10.0f, me->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 90000); + me->SummonCreature(NPC_GHOUL, me->GetPositionX()+8.0f, me->GetPositionY()+8.0f, me->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 90000); + break; + case 15: + DoScriptText(SAY_WP_2, me); + case 21: + Theldanis = GetClosestCreatureWithEntry(me, NPC_THEL_DANIS, 150); + DoScriptText(SAY_WP_3, Theldanis); + break; + case 22: + break; + case 23: + Ughost = me->SummonCreature(NPC_GHOST_UTHER, 971.86,-1825.42 ,81.99 , 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + Ughost->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + DoScriptText(SAY_WP_4, Ughost, me); + m_uiChatTimer = 4000; + break; + case 24: + DoScriptText(SAY_WP_5, Ughost, me); + m_uiChatTimer = 4000; + break; + case 25: + DoScriptText(SAY_WP_6, Ughost, me); + m_uiChatTimer = 4000; + break; + case 26: + if (pPlayer) + pPlayer->GroupEventHappens(QUEST_TOMB_LIGHTBRINGER, me); + break; + } } - } - void EnterCombat(Unit* /*pWho*/){} + void EnterCombat(Unit* /*pWho*/){} - void JustDied(Unit* /*pKiller*/) - { - Player* pPlayer = GetPlayerForEscort(); - if (pPlayer) - pPlayer->FailQuest(QUEST_TOMB_LIGHTBRINGER); - } + void JustDied(Unit* /*pKiller*/) + { + Player* pPlayer = GetPlayerForEscort(); + if (pPlayer) + pPlayer->FailQuest(QUEST_TOMB_LIGHTBRINGER); + } - void UpdateAI(const uint32 uiDiff) - { - npc_escortAI::UpdateAI(uiDiff); - DoMeleeAttackIfReady(); - if (HasEscortState(STATE_ESCORT_ESCORTING)) - m_uiChatTimer = 6000; - } -}; + void UpdateAI(const uint32 uiDiff) + { + npc_escortAI::UpdateAI(uiDiff); + DoMeleeAttackIfReady(); + if (HasEscortState(STATE_ESCORT_ESCORTING)) + m_uiChatTimer = 6000; + } + }; -CreatureAI* GetAI_npc_anchorite_truuen(Creature* pCreature) -{ - return new npc_anchorite_truuenAI(pCreature); -} +}; -bool QuestAccept_npc_anchorite_truuen(Player* pPlayer, Creature* pCreature, Quest const *quest) -{ - npc_escortAI* pEscortAI = CAST_AI(npc_anchorite_truuenAI, pCreature->AI()); - if (quest->GetQuestId() == QUEST_TOMB_LIGHTBRINGER) - pEscortAI->Start(true, true, pPlayer->GetGUID()); - return false; -} /*###### ## @@ -366,33 +402,9 @@ bool QuestAccept_npc_anchorite_truuen(Player* pPlayer, Creature* pCreature, Ques void AddSC_western_plaguelands() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npcs_dithers_and_arbington"; - newscript->pGossipHello = &GossipHello_npcs_dithers_and_arbington; - newscript->pGossipSelect = &GossipSelect_npcs_dithers_and_arbington; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_myranda_the_hag"; - newscript->pGossipHello = &GossipHello_npc_myranda_the_hag; - newscript->pGossipSelect = &GossipSelect_npc_myranda_the_hag; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_the_scourge_cauldron"; - newscript->GetAI = &GetAI_npc_the_scourge_cauldron; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_andorhal_tower"; - newscript->GetAI = &GetAI_npc_andorhal_tower; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_anchorite_truuen"; - newscript->GetAI = &GetAI_npc_anchorite_truuen; - newscript->pQuestAccept = &QuestAccept_npc_anchorite_truuen; - newscript->RegisterSelf(); + new npcs_dithers_and_arbington(); + new npc_myranda_the_hag(); + new npc_the_scourge_cauldron(); + new npc_andorhal_tower(); + new npc_anchorite_truuen(); } diff --git a/src/server/scripts/EasternKingdoms/westfall.cpp b/src/server/scripts/EasternKingdoms/westfall.cpp index e706594dcf5..14e33177555 100644 --- a/src/server/scripts/EasternKingdoms/westfall.cpp +++ b/src/server/scripts/EasternKingdoms/westfall.cpp @@ -48,138 +48,146 @@ enum eEnums NPC_DEFIAS_RAIDER = 6180, EQUIP_ID_RIFLE = 2511 }; - -struct npc_daphne_stilwellAI : public npc_escortAI +
class npc_daphne_stilwell : public CreatureScript { - npc_daphne_stilwellAI(Creature* pCreature) : npc_escortAI(pCreature) {} - - uint32 uiWPHolder; - uint32 uiShootTimer; +public: + npc_daphne_stilwell() : CreatureScript("npc_daphne_stilwell") { } - void Reset() + bool OnQuestAccept(Player* pPlayer, Creature* pCreature, const Quest* pQuest) { - if (HasEscortState(STATE_ESCORT_ESCORTING)) + if (pQuest->GetQuestId() == QUEST_TOME_VALOR) { - switch(uiWPHolder) - { - case 7: DoScriptText(SAY_DS_DOWN_1, me); break; - case 8: DoScriptText(SAY_DS_DOWN_2, me); break; - case 9: DoScriptText(SAY_DS_DOWN_3, me); break; - } + DoScriptText(SAY_DS_START, pCreature); + + if (npc_escortAI* pEscortAI = CAST_AI(npc_daphne_stilwell::npc_daphne_stilwellAI, pCreature->AI())) + pEscortAI->Start(true, true, pPlayer->GetGUID()); } - else - uiWPHolder = 0; - uiShootTimer = 0; + return true; } - void WaypointReached(uint32 uiPoint) + CreatureAI* GetAI(Creature* pCreature) const { - Player* pPlayer = GetPlayerForEscort(); + return new npc_daphne_stilwellAI(pCreature); + } - if (!pPlayer) - return; + struct npc_daphne_stilwellAI : public npc_escortAI + { + npc_daphne_stilwellAI(Creature* pCreature) : npc_escortAI(pCreature) {} - uiWPHolder = uiPoint; + uint32 uiWPHolder; + uint32 uiShootTimer; - switch(uiPoint) + void Reset() { - case 4: - SetEquipmentSlots(false, EQUIP_NO_CHANGE, EQUIP_NO_CHANGE, EQUIP_ID_RIFLE); - me->SetSheath(SHEATH_STATE_RANGED); - me->HandleEmoteCommand(EMOTE_STATE_USESTANDING_NOSHEATHE); - break; - case 7: - me->SummonCreature(NPC_DEFIAS_RAIDER, -11450.836, 1569.755, 54.267, 4.230, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - me->SummonCreature(NPC_DEFIAS_RAIDER, -11449.697, 1569.124, 54.421, 4.206, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - me->SummonCreature(NPC_DEFIAS_RAIDER, -11448.237, 1568.307, 54.620, 4.206, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - break; - case 8: - me->SetSheath(SHEATH_STATE_RANGED); - me->SummonCreature(NPC_DEFIAS_RAIDER, -11450.836, 1569.755, 54.267, 4.230, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - me->SummonCreature(NPC_DEFIAS_RAIDER, -11449.697, 1569.124, 54.421, 4.206, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - me->SummonCreature(NPC_DEFIAS_RAIDER, -11448.237, 1568.307, 54.620, 4.206, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - me->SummonCreature(NPC_DEFIAS_RAIDER, -11448.037, 1570.213, 54.961, 4.283, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - break; - case 9: - me->SetSheath(SHEATH_STATE_RANGED); - me->SummonCreature(NPC_DEFIAS_RAIDER, -11450.836, 1569.755, 54.267, 4.230, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - me->SummonCreature(NPC_DEFIAS_RAIDER, -11449.697, 1569.124, 54.421, 4.206, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - me->SummonCreature(NPC_DEFIAS_RAIDER, -11448.237, 1568.307, 54.620, 4.206, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - me->SummonCreature(NPC_DEFIAS_RAIDER, -11448.037, 1570.213, 54.961, 4.283, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - me->SummonCreature(NPC_DEFIAS_RAIDER, -11449.018, 1570.738, 54.828, 4.220, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - break; - case 10: - SetRun(false); - break; - case 11: - DoScriptText(SAY_DS_PROLOGUE, me); - break; - case 13: - SetEquipmentSlots(true); - me->SetSheath(SHEATH_STATE_UNARMED); - me->HandleEmoteCommand(EMOTE_STATE_USESTANDING_NOSHEATHE); - break; - case 17: - pPlayer->GroupEventHappens(QUEST_TOME_VALOR, me); - break; - } - } + if (HasEscortState(STATE_ESCORT_ESCORTING)) + { + switch(uiWPHolder) + { + case 7: DoScriptText(SAY_DS_DOWN_1, me); break; + case 8: DoScriptText(SAY_DS_DOWN_2, me); break; + case 9: DoScriptText(SAY_DS_DOWN_3, me); break; + } + } + else + uiWPHolder = 0; - void AttackStart(Unit* pWho) - { - if (!pWho) - return; + uiShootTimer = 0; + } - if (me->Attack(pWho, false)) + void WaypointReached(uint32 uiPoint) { - me->AddThreat(pWho, 0.0f); - me->SetInCombatWith(pWho); - pWho->SetInCombatWith(me); + Player* pPlayer = GetPlayerForEscort(); + + if (!pPlayer) + return; + + uiWPHolder = uiPoint; - me->GetMotionMaster()->MoveChase(pWho, 30.0f); + switch(uiPoint) + { + case 4: + SetEquipmentSlots(false, EQUIP_NO_CHANGE, EQUIP_NO_CHANGE, EQUIP_ID_RIFLE); + me->SetSheath(SHEATH_STATE_RANGED); + me->HandleEmoteCommand(EMOTE_STATE_USESTANDING_NOSHEATHE); + break; + case 7: + me->SummonCreature(NPC_DEFIAS_RAIDER, -11450.836, 1569.755, 54.267, 4.230, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + me->SummonCreature(NPC_DEFIAS_RAIDER, -11449.697, 1569.124, 54.421, 4.206, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + me->SummonCreature(NPC_DEFIAS_RAIDER, -11448.237, 1568.307, 54.620, 4.206, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + break; + case 8: + me->SetSheath(SHEATH_STATE_RANGED); + me->SummonCreature(NPC_DEFIAS_RAIDER, -11450.836, 1569.755, 54.267, 4.230, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + me->SummonCreature(NPC_DEFIAS_RAIDER, -11449.697, 1569.124, 54.421, 4.206, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + me->SummonCreature(NPC_DEFIAS_RAIDER, -11448.237, 1568.307, 54.620, 4.206, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + me->SummonCreature(NPC_DEFIAS_RAIDER, -11448.037, 1570.213, 54.961, 4.283, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + break; + case 9: + me->SetSheath(SHEATH_STATE_RANGED); + me->SummonCreature(NPC_DEFIAS_RAIDER, -11450.836, 1569.755, 54.267, 4.230, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + me->SummonCreature(NPC_DEFIAS_RAIDER, -11449.697, 1569.124, 54.421, 4.206, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + me->SummonCreature(NPC_DEFIAS_RAIDER, -11448.237, 1568.307, 54.620, 4.206, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + me->SummonCreature(NPC_DEFIAS_RAIDER, -11448.037, 1570.213, 54.961, 4.283, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + me->SummonCreature(NPC_DEFIAS_RAIDER, -11449.018, 1570.738, 54.828, 4.220, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + break; + case 10: + SetRun(false); + break; + case 11: + DoScriptText(SAY_DS_PROLOGUE, me); + break; + case 13: + SetEquipmentSlots(true); + me->SetSheath(SHEATH_STATE_UNARMED); + me->HandleEmoteCommand(EMOTE_STATE_USESTANDING_NOSHEATHE); + break; + case 17: + pPlayer->GroupEventHappens(QUEST_TOME_VALOR, me); + break; + } } - } - void JustSummoned(Creature* pSummoned) - { - pSummoned->AI()->AttackStart(me); - } + void AttackStart(Unit* pWho) + { + if (!pWho) + return; - void Update(const uint32 diff) - { - npc_escortAI::UpdateAI(diff); + if (me->Attack(pWho, false)) + { + me->AddThreat(pWho, 0.0f); + me->SetInCombatWith(pWho); + pWho->SetInCombatWith(me); - if (!UpdateVictim()) - return; + me->GetMotionMaster()->MoveChase(pWho, 30.0f); + } + } - if (uiShootTimer <= diff) + void JustSummoned(Creature* pSummoned) { - uiShootTimer = 1500; + pSummoned->AI()->AttackStart(me); + } - if (!me->IsWithinDist(me->getVictim(), ATTACK_DISTANCE)) - DoCast(me->getVictim(), SPELL_SHOOT); - } else uiShootTimer -= diff; - } -}; + void Update(const uint32 diff) + { + npc_escortAI::UpdateAI(diff); -bool QuestAccept_npc_daphne_stilwell(Player* pPlayer, Creature* pCreature, const Quest* pQuest) -{ - if (pQuest->GetQuestId() == QUEST_TOME_VALOR) - { - DoScriptText(SAY_DS_START, pCreature); + if (!UpdateVictim()) + return; - if (npc_escortAI* pEscortAI = CAST_AI(npc_daphne_stilwellAI, pCreature->AI())) - pEscortAI->Start(true, true, pPlayer->GetGUID()); - } + if (uiShootTimer <= diff) + { + uiShootTimer = 1500; + + if (!me->IsWithinDist(me->getVictim(), ATTACK_DISTANCE)) + DoCast(me->getVictim(), SPELL_SHOOT); + } else uiShootTimer -= diff; + } + }; + +}; - return true; -} -CreatureAI* GetAI_npc_daphne_stilwell(Creature* pCreature) -{ - return new npc_daphne_stilwellAI(pCreature); -} /*###### ## npc_defias_traitor @@ -192,74 +200,71 @@ CreatureAI* GetAI_npc_daphne_stilwell(Creature* pCreature) #define SAY_AGGRO_2 -1000105 #define QUEST_DEFIAS_BROTHERHOOD 155 - -struct npc_defias_traitorAI : public npc_escortAI +
class npc_defias_traitor : public CreatureScript { - npc_defias_traitorAI(Creature *c) : npc_escortAI(c) { Reset(); } +public: + npc_defias_traitor() : CreatureScript("npc_defias_traitor") { } - void WaypointReached(uint32 i) + bool OnQuestAccept(Player* pPlayer, Creature* pCreature, Quest const* quest) { - Player* pPlayer = GetPlayerForEscort(); - - if (!pPlayer) - return; - - switch (i) + if (quest->GetQuestId() == QUEST_DEFIAS_BROTHERHOOD) { - case 35: - SetRun(false); - break; - case 36: - DoScriptText(SAY_PROGRESS, me, pPlayer); - break; - case 44: - DoScriptText(SAY_END, me, pPlayer); - { - if (pPlayer) - pPlayer->GroupEventHappens(QUEST_DEFIAS_BROTHERHOOD,me); - } - break; + if (npc_escortAI* pEscortAI = CAST_AI(npc_defias_traitor::npc_defias_traitorAI, pCreature->AI())) + pEscortAI->Start(true, true, pPlayer->GetGUID()); + + DoScriptText(SAY_START, pCreature, pPlayer); } + + return true; } - void EnterCombat(Unit* who) + + CreatureAI* GetAI(Creature* pCreature) const { - DoScriptText(RAND(SAY_AGGRO_1,SAY_AGGRO_2), me, who); + return new npc_defias_traitorAI(pCreature); } - void Reset() {} -}; - -bool QuestAccept_npc_defias_traitor(Player* pPlayer, Creature* pCreature, Quest const* quest) -{ - if (quest->GetQuestId() == QUEST_DEFIAS_BROTHERHOOD) + struct npc_defias_traitorAI : public npc_escortAI { - if (npc_escortAI* pEscortAI = CAST_AI(npc_defias_traitorAI, pCreature->AI())) - pEscortAI->Start(true, true, pPlayer->GetGUID()); + npc_defias_traitorAI(Creature *c) : npc_escortAI(c) { Reset(); } - DoScriptText(SAY_START, pCreature, pPlayer); - } + void WaypointReached(uint32 i) + { + Player* pPlayer = GetPlayerForEscort(); + + if (!pPlayer) + return; + + switch (i) + { + case 35: + SetRun(false); + break; + case 36: + DoScriptText(SAY_PROGRESS, me, pPlayer); + break; + case 44: + DoScriptText(SAY_END, me, pPlayer); + { + if (pPlayer) + pPlayer->GroupEventHappens(QUEST_DEFIAS_BROTHERHOOD,me); + } + break; + } + } + void EnterCombat(Unit* who) + { + DoScriptText(RAND(SAY_AGGRO_1,SAY_AGGRO_2), me, who); + } + + void Reset() {} + }; + +}; - return true; -} -CreatureAI* GetAI_npc_defias_traitor(Creature* pCreature) -{ - return new npc_defias_traitorAI(pCreature); -} void AddSC_westfall() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_daphne_stilwell"; - newscript->GetAI = &GetAI_npc_daphne_stilwell; - newscript->pQuestAccept = &QuestAccept_npc_daphne_stilwell; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_defias_traitor"; - newscript->GetAI = &GetAI_npc_defias_traitor; - newscript->pQuestAccept = &QuestAccept_npc_defias_traitor; - newscript->RegisterSelf(); + new npc_daphne_stilwell(); + new npc_defias_traitor(); } diff --git a/src/server/scripts/EasternKingdoms/wetlands.cpp b/src/server/scripts/EasternKingdoms/wetlands.cpp index 084b673dacd..bfac81a4ba0 100644 --- a/src/server/scripts/EasternKingdoms/wetlands.cpp +++ b/src/server/scripts/EasternKingdoms/wetlands.cpp @@ -44,111 +44,124 @@ enum eTapokeSlim NPC_SLIMS_FRIEND = 4971, NPC_TAPOKE_SLIM_JAHN = 4962 }; - -struct npc_tapoke_slim_jahnAI : public npc_escortAI +
class npc_tapoke_slim_jahn : public CreatureScript { - npc_tapoke_slim_jahnAI(Creature* pCreature) : npc_escortAI(pCreature) { } - - bool m_bFriendSummoned; +public: + npc_tapoke_slim_jahn() : CreatureScript("npc_tapoke_slim_jahn") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - if (!HasEscortState(STATE_ESCORT_ESCORTING)) - m_bFriendSummoned = false; + return new npc_tapoke_slim_jahnAI(pCreature); } - void WaypointReached(uint32 uiPointId) + struct npc_tapoke_slim_jahnAI : public npc_escortAI { - switch(uiPointId) - { - case 2: - if (me->HasStealthAura()) - me->RemoveAurasByType(SPELL_AURA_MOD_STEALTH); + npc_tapoke_slim_jahnAI(Creature* pCreature) : npc_escortAI(pCreature) { } - SetRun(); - me->setFaction(FACTION_ENEMY); - break; + bool m_bFriendSummoned; + + void Reset() + { + if (!HasEscortState(STATE_ESCORT_ESCORTING)) + m_bFriendSummoned = false; } - } - void EnterCombat(Unit* /*pWho*/) - { - Player* pPlayer = GetPlayerForEscort(); + void WaypointReached(uint32 uiPointId) + { + switch(uiPointId) + { + case 2: + if (me->HasStealthAura()) + me->RemoveAurasByType(SPELL_AURA_MOD_STEALTH); + + SetRun(); + me->setFaction(FACTION_ENEMY); + break; + } + } - if (HasEscortState(STATE_ESCORT_ESCORTING) && !m_bFriendSummoned && pPlayer) + void EnterCombat(Unit* /*pWho*/) { - for (uint8 i = 0; i < 3; ++i) - DoCast(me, SPELL_CALL_FRIENDS, true); + Player* pPlayer = GetPlayerForEscort(); - m_bFriendSummoned = true; + if (HasEscortState(STATE_ESCORT_ESCORTING) && !m_bFriendSummoned && pPlayer) + { + for (uint8 i = 0; i < 3; ++i) + DoCast(me, SPELL_CALL_FRIENDS, true); + + m_bFriendSummoned = true; + } } - } - void JustSummoned(Creature* pSummoned) - { - if (Player* pPlayer = GetPlayerForEscort()) - pSummoned->AI()->AttackStart(pPlayer); - } + void JustSummoned(Creature* pSummoned) + { + if (Player* pPlayer = GetPlayerForEscort()) + pSummoned->AI()->AttackStart(pPlayer); + } - void AttackedBy(Unit* pAttacker) - { - if (me->getVictim()) - return; + void AttackedBy(Unit* pAttacker) + { + if (me->getVictim()) + return; - if (me->IsFriendlyTo(pAttacker)) - return; + if (me->IsFriendlyTo(pAttacker)) + return; - AttackStart(pAttacker); - } + AttackStart(pAttacker); + } - void DamageTaken(Unit* /*pDoneBy*/, uint32& uiDamage) - { - if (me->GetHealth()*100 < me->GetMaxHealth()*20) + void DamageTaken(Unit* /*pDoneBy*/, uint32& uiDamage) { - if (Player* pPlayer = GetPlayerForEscort()) + if (me->GetHealth()*100 < me->GetMaxHealth()*20) { - if (pPlayer->GetTypeId() == TYPEID_PLAYER) - CAST_PLR(pPlayer)->GroupEventHappens(QUEST_MISSING_DIPLO_PT11, me); + if (Player* pPlayer = GetPlayerForEscort()) + { + if (pPlayer->GetTypeId() == TYPEID_PLAYER) + CAST_PLR(pPlayer)->GroupEventHappens(QUEST_MISSING_DIPLO_PT11, me); - uiDamage = 0; + uiDamage = 0; - me->RestoreFaction(); - me->RemoveAllAuras(); - me->DeleteThreatList(); - me->CombatStop(true); + me->RestoreFaction(); + me->RemoveAllAuras(); + me->DeleteThreatList(); + me->CombatStop(true); - SetRun(false); + SetRun(false); + } } } - } + }; + }; -CreatureAI* GetAI_npc_tapoke_slim_jahn(Creature* pCreature) -{ - return new npc_tapoke_slim_jahnAI(pCreature); -} /*###### ## npc_mikhail ######*/ - -bool QuestAccept_npc_mikhail(Player* pPlayer, Creature* pCreature, const Quest* pQuest) +
class npc_mikhail : public CreatureScript { - if (pQuest->GetQuestId() == QUEST_MISSING_DIPLO_PT11) +public: + npc_mikhail() : CreatureScript("npc_mikhail") { } + + bool OnQuestAccept(Player* pPlayer, Creature* pCreature, const Quest* pQuest) { - Creature* pSlim = pCreature->FindNearestCreature(NPC_TAPOKE_SLIM_JAHN, 25.0f); + if (pQuest->GetQuestId() == QUEST_MISSING_DIPLO_PT11) + { + Creature* pSlim = pCreature->FindNearestCreature(NPC_TAPOKE_SLIM_JAHN, 25.0f); - if (!pSlim) - return false; + if (!pSlim) + return false; - if (!pSlim->HasStealthAura()) - pSlim->CastSpell(pSlim, SPELL_STEALTH, true); + if (!pSlim->HasStealthAura()) + pSlim->CastSpell(pSlim, SPELL_STEALTH, true); - if (npc_tapoke_slim_jahnAI* pEscortAI = CAST_AI(npc_tapoke_slim_jahnAI, pSlim->AI())) - pEscortAI->Start(false, false, pPlayer->GetGUID(), pQuest); + if (npc_tapoke_slim_jahn::npc_tapoke_slim_jahnAI* pEscortAI = CAST_AI(npc_tapoke_slim_jahn::npc_tapoke_slim_jahnAI, pSlim->AI())) + pEscortAI->Start(false, false, pPlayer->GetGUID(), pQuest); + } + return false; } - return false; -} + +}; /*###### ## AddSC @@ -156,15 +169,6 @@ bool QuestAccept_npc_mikhail(Player* pPlayer, Creature* pCreature, const Quest* void AddSC_wetlands() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_tapoke_slim_jahn"; - newscript->GetAI = &GetAI_npc_tapoke_slim_jahn; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_mikhail"; - newscript->pQuestAccept = &QuestAccept_npc_mikhail; - newscript->RegisterSelf(); + new npc_tapoke_slim_jahn(); + new npc_mikhail(); } |
