diff options
| author | Vincent_Michael <Vincent_Michael@gmx.de> | 2013-12-08 20:27:46 +0100 |
|---|---|---|
| committer | Vincent_Michael <Vincent_Michael@gmx.de> | 2013-12-08 20:27:46 +0100 |
| commit | e8be55aa8b3facd776303a34acf6048f50dcfa51 (patch) | |
| tree | db95abc0bd54a7693025306c3b435d672da00800 /src/server/scripts/Northrend | |
| parent | 214d0822ce41fb326a9763ae7507923fdfa659f1 (diff) | |
| parent | 5c15e88da9037af885c40a55aeea581c520148d7 (diff) | |
Merge branch 'master' of github.com:TrinityCore/TrinityCore into 4.3.4
Conflicts:
src/server/game/AI/CoreAI/TotemAI.cpp
src/server/game/Entities/Player/Player.cpp
src/server/game/Entities/Unit/Unit.cpp
src/server/game/Globals/ObjectMgr.cpp
src/server/game/Guilds/Guild.cpp
src/server/game/Guilds/Guild.h
src/server/game/Movement/Spline/MoveSplineInit.cpp
src/server/game/Movement/Spline/MovementPacketBuilder.cpp
src/server/game/Movement/Spline/MovementPacketBuilder.h
src/server/game/Spells/SpellMgr.cpp
src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_nefarian.cpp
src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp
src/server/scripts/EasternKingdoms/zone_silverpine_forest.cpp
src/server/scripts/Kalimdor/zone_mulgore.cpp
src/server/scripts/Kalimdor/zone_stonetalon_mountains.cpp
src/server/shared/Database/Implementation/CharacterDatabase.cpp
Diffstat (limited to 'src/server/scripts/Northrend')
28 files changed, 2314 insertions, 3149 deletions
diff --git a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/instance_forge_of_souls.cpp b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/instance_forge_of_souls.cpp index ae57732e9e2..b1339b13119 100644 --- a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/instance_forge_of_souls.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/instance_forge_of_souls.cpp @@ -43,12 +43,21 @@ class instance_forge_of_souls : public InstanceMapScript teamInInstance = 0; } + void OnPlayerEnter(Player* player) OVERRIDE + { + if (!teamInInstance) + teamInInstance = player->GetTeam(); + } + void OnCreatureCreate(Creature* creature) OVERRIDE { - Map::PlayerList const &players = instance->GetPlayers(); - if (!players.isEmpty()) - if (Player* player = players.begin()->GetSource()) - teamInInstance = player->GetTeam(); + if (!teamInInstance) + { + Map::PlayerList const& players = instance->GetPlayers(); + if (!players.isEmpty()) + if (Player* player = players.begin()->GetSource()) + teamInInstance = player->GetTeam(); + } switch (creature->GetEntry()) { diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp index 1b82de35f54..06355e25207 100644 --- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp @@ -1089,9 +1089,9 @@ class npc_jaina_or_sylvanas_escape_hor : public CreatureScript break; case EVENT_ESCAPE_27: if (_instance->GetData(DATA_TEAM_IN_INSTANCE) == ALLIANCE) - me->SummonGameObject(GO_CAPTAIN_CHEST_1, ChestPos.GetPositionX(), ChestPos.GetPositionY(), ChestPos.GetPositionZ(), ChestPos.GetOrientation(), 0, 0, 0, 0, 720000); + me->SummonGameObject(IsHeroic() ? GO_CAPTAIN_CHEST_ALLIANCE_HEROIC : GO_CAPTAIN_CHEST_ALLIANCE_NORMAL, ChestPos.GetPositionX(), ChestPos.GetPositionY(), ChestPos.GetPositionZ(), ChestPos.GetOrientation(), 0, 0, 0, 0, 720000); else - me->SummonGameObject(GO_CAPTAIN_CHEST_3, ChestPos.GetPositionX(), ChestPos.GetPositionY(), ChestPos.GetPositionZ(), ChestPos.GetOrientation(), 0, 0, 0, 0, 720000); + me->SummonGameObject(IsHeroic() ? GO_CAPTAIN_CHEST_HORDE_HEROIC : GO_CAPTAIN_CHEST_HORDE_NORMAL, ChestPos.GetPositionX(), ChestPos.GetPositionY(), ChestPos.GetPositionZ(), ChestPos.GetOrientation(), 0, 0, 0, 0, 720000); me->SummonGameObject(GO_PORTAL, FinalPortalPos.GetPositionX(), FinalPortalPos.GetPositionY(), FinalPortalPos.GetPositionZ(), FinalPortalPos.GetOrientation(), 0, 0, 0, 0, 720000); if (Creature* lichking = ObjectAccessor::GetCreature(*me, _lichkingGUID)) lichking->DespawnOrUnsummon(1); @@ -1121,6 +1121,7 @@ enum TrashSpells SPELL_FROSTBOLT = 72166, SPELL_CHAINS_OF_ICE = 72121, SPELL_HALLUCINATION = 72342, + AURA_HALLUCINATION = 72343, // Phantom Hallucination (same as phantom mage + HALLUCINATION_2 when dies) SPELL_HALLUCINATION_2 = 72344, @@ -1180,10 +1181,7 @@ enum TrashEvents struct npc_gauntlet_trash : public ScriptedAI { - npc_gauntlet_trash(Creature* creature) : ScriptedAI(creature), - _instance(creature->GetInstanceScript()) - { - } + npc_gauntlet_trash(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()) { } void Reset() OVERRIDE { @@ -1226,9 +1224,7 @@ public: struct npc_ghostly_priestAI : public npc_gauntlet_trash { - npc_ghostly_priestAI(Creature* creature) : npc_gauntlet_trash(creature) - { - } + npc_ghostly_priestAI(Creature* creature) : npc_gauntlet_trash(creature) { } void EnterCombat(Unit* /*who*/) OVERRIDE { @@ -1297,8 +1293,12 @@ public: struct npc_phantom_mageAI : public npc_gauntlet_trash { - npc_phantom_mageAI(Creature* creature) : npc_gauntlet_trash(creature) + npc_phantom_mageAI(Creature* creature) : npc_gauntlet_trash(creature) { } + + void EnterEvadeMode() OVERRIDE { + if (!me->HasAura(AURA_HALLUCINATION)) + npc_gauntlet_trash::EnterEvadeMode(); } void EnterCombat(Unit* /*who*/) OVERRIDE @@ -1342,6 +1342,8 @@ public: _events.ScheduleEvent(EVENT_CHAINS_OF_ICE, 15000); break; case EVENT_HALLUCINATION: + // removing any dots on mage or else the invisibility spell will break duration + me->RemoveAllAuras(); DoCast(SPELL_HALLUCINATION); break; } @@ -1365,6 +1367,19 @@ public: { npc_phantom_hallucinationAI(Creature* creature) : npc_phantom_mage::npc_phantom_mageAI(creature) { } + void Reset() OVERRIDE + { + if (Unit* unit = me->SelectNearestTarget()) + AttackStart(unit); + DoZoneInCombat(); + } + + void EnterEvadeMode() OVERRIDE + { + if (!me->GetOwner()->HasAura(AURA_HALLUCINATION)) + npc_phantom_mage::npc_phantom_mageAI::EnterEvadeMode(); + } + void JustDied(Unit* /*killer*/) OVERRIDE { DoCast(SPELL_HALLUCINATION_2); @@ -1384,9 +1399,7 @@ public: struct npc_shadowy_mercenaryAI : public npc_gauntlet_trash { - npc_shadowy_mercenaryAI(Creature* creature) : npc_gauntlet_trash(creature) - { - } + npc_shadowy_mercenaryAI(Creature* creature) : npc_gauntlet_trash(creature) { } void EnterCombat(Unit* /*who*/) OVERRIDE { @@ -1444,9 +1457,7 @@ public: struct npc_spectral_footmanAI : public npc_gauntlet_trash { - npc_spectral_footmanAI(Creature* creature) : npc_gauntlet_trash(creature) - { - } + npc_spectral_footmanAI(Creature* creature) : npc_gauntlet_trash(creature) { } void EnterCombat(Unit* /*who*/) OVERRIDE { @@ -1498,9 +1509,7 @@ public: struct npc_tortured_riflemanAI : public npc_gauntlet_trash { - npc_tortured_riflemanAI(Creature* creature) : npc_gauntlet_trash(creature) - { - } + npc_tortured_riflemanAI(Creature* creature) : npc_gauntlet_trash(creature) { } void EnterCombat(Unit* /*who*/) OVERRIDE { diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.h b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.h index d8d4f2d5524..9c40cb70141 100644 --- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.h +++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.h @@ -95,10 +95,10 @@ enum GameObjects GO_ORGRIM_HAMMER = 201599, GO_PORTAL = 202079, - GO_CAPTAIN_CHEST_1 = 202212, //3145 - GO_CAPTAIN_CHEST_2 = 201710, //30357 - GO_CAPTAIN_CHEST_3 = 202337, //3246 - GO_CAPTAIN_CHEST_4 = 202336, //3333 + GO_CAPTAIN_CHEST_HORDE_NORMAL = 202212, //3145 + GO_CAPTAIN_CHEST_ALLIANCE_NORMAL = 201710, //30357 + GO_CAPTAIN_CHEST_HORDE_HEROIC = 202337, //3246 + GO_CAPTAIN_CHEST_ALLIANCE_HEROIC = 202336, //3333 }; enum HorWorldStates diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/instance_halls_of_reflection.cpp b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/instance_halls_of_reflection.cpp index 0599596fc0a..955f4fb1568 100644 --- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/instance_halls_of_reflection.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/instance_halls_of_reflection.cpp @@ -110,10 +110,13 @@ public: void OnCreatureCreate(Creature* creature) OVERRIDE { - Map::PlayerList const& players = instance->GetPlayers(); - if (!players.isEmpty()) - if (Player* player = players.begin()->GetSource()) - _teamInInstance = player->GetTeam(); + if (!_teamInInstance) + { + Map::PlayerList const& players = instance->GetPlayers(); + if (!players.isEmpty()) + if (Player* player = players.begin()->GetSource()) + _teamInInstance = player->GetTeam(); + } switch (creature->GetEntry()) { @@ -184,7 +187,7 @@ public: case GO_ARTHAS_DOOR: _arthasDoorGUID = go->GetGUID(); go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_INTERACT_COND); - if (GetBossState(DATA_FROSWORN_EVENT) == DONE) + if (GetData(DATA_FROSWORN_EVENT) == DONE) HandleGameObject(0, true, go); else HandleGameObject(0, false, go); @@ -511,13 +514,13 @@ public: OUT_SAVE_INST_DATA; std::ostringstream saveStream; - saveStream << "H R " << GetBossSaveData() << _introEvent << ' ' << _frostwornGeneral << _escapeevent; + saveStream << "H R " << GetBossSaveData() << _introEvent << ' ' << _frostwornGeneral << ' ' << _escapeevent; OUT_SAVE_INST_DATA_COMPLETE; return saveStream.str(); } - void Load(char const* in) OVERRIDE OVERRIDE + void Load(char const* in) OVERRIDE { if (!in) { diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp index 20b7d39815f..4a9a41f6f8e 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp @@ -187,7 +187,7 @@ class boss_garfrost : public CreatureScript switch (eventId) { case EVENT_THROW_SARONITE: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true)) { Talk(SAY_THROW_SARONITE, target->GetGUID()); DoCast(target, SPELL_THROW_SARONITE); @@ -199,7 +199,7 @@ class boss_garfrost : public CreatureScript events.ScheduleEvent(EVENT_CHILLING_WAVE, 40000, 0, PHASE_TWO); break; case EVENT_DEEP_FREEZE: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true)) { Talk(SAY_CAST_DEEP_FREEZE, target->GetGUID()); DoCast(target, SPELL_DEEP_FREEZE); diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp index d8a4dd01f90..48cc6f89a13 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp @@ -385,32 +385,25 @@ class boss_rimefang : public CreatureScript class player_overlord_brandAI : public PlayerAI { public: - player_overlord_brandAI(Player* player) : PlayerAI(player), _tyrannus(0) - { - } - - void SetGUID(uint64 guid, int32 /*type*/) OVERRIDE - { - _tyrannus = guid; - } + player_overlord_brandAI(Player* player, uint64 casterGUID) : PlayerAI(player), _tyrannusGUID(casterGUID) { } void DamageDealt(Unit* /*victim*/, uint32& damage, DamageEffectType /*damageType*/) OVERRIDE { - if (Creature* tyrannus = ObjectAccessor::GetCreature(*me, _tyrannus)) - if (tyrannus->GetVictim()) - me->CastCustomSpell(SPELL_OVERLORD_BRAND_DAMAGE, SPELLVALUE_BASE_POINT0, damage, tyrannus->GetVictim(), true, NULL, NULL, tyrannus->GetGUID()); + if (Creature* tyrannus = ObjectAccessor::GetCreature(*me, _tyrannusGUID)) + if (Unit* victim = tyrannus->GetVictim()) + me->CastCustomSpell(SPELL_OVERLORD_BRAND_DAMAGE, SPELLVALUE_BASE_POINT0, damage, victim, true, NULL, NULL, tyrannus->GetGUID()); } void HealDone(Unit* /*target*/, uint32& addHealth) OVERRIDE { - if (Creature* tyrannus = ObjectAccessor::GetCreature(*me, _tyrannus)) - me->CastCustomSpell(SPELL_OVERLORD_BRAND_HEAL, SPELLVALUE_BASE_POINT0, int32(addHealth*5.5f), tyrannus, true, NULL, NULL, tyrannus->GetGUID()); + if (Creature* tyrannus = ObjectAccessor::GetCreature(*me, _tyrannusGUID)) + me->CastCustomSpell(SPELL_OVERLORD_BRAND_HEAL, SPELLVALUE_BASE_POINT0, int32(addHealth * 5.5f), tyrannus, true, NULL, NULL, tyrannus->GetGUID()); } void UpdateAI(uint32 /*diff*/) OVERRIDE { } private: - uint64 _tyrannus; + uint64 _tyrannusGUID; }; class spell_tyrannus_overlord_brand : public SpellScriptLoader @@ -434,8 +427,8 @@ class spell_tyrannus_overlord_brand : public SpellScriptLoader oldAI = GetTarget()->GetAI(); oldAIState = GetTarget()->IsAIEnabled; - GetTarget()->SetAI(new player_overlord_brandAI(GetTarget()->ToPlayer())); - GetTarget()->GetAI()->SetGUID(GetCasterGUID()); + GetTarget()->SetAI(new player_overlord_brandAI(GetTarget()->ToPlayer(), GetCasterGUID())); + GetTarget()->IsAIEnabled = true; } void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp index 7aa8b123f98..d61fc69a0ae 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp @@ -63,7 +63,7 @@ class instance_pit_of_saron : public InstanceMapScript { if (!_teamInInstance) { - Map::PlayerList const &players = instance->GetPlayers(); + Map::PlayerList const& players = instance->GetPlayers(); if (!players.isEmpty()) if (Player* player = players.begin()->GetSource()) _teamInInstance = player->GetTeam(); diff --git a/src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp b/src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp index a1511fb3dd8..4777b451e4e 100644 --- a/src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp +++ b/src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp @@ -165,7 +165,7 @@ public: unit->SetControlled(true, UNIT_STATE_ROOT); } - void ProcessEvent(WorldObject* /*obj*/, uint32 eventId) + void ProcessEvent(WorldObject* /*obj*/, uint32 eventId) OVERRIDE { if (eventId == EVENT_FOCUSING_IRIS) { diff --git a/src/server/scripts/Northrend/Nexus/Oculus/boss_drakos.cpp b/src/server/scripts/Northrend/Nexus/Oculus/boss_drakos.cpp index 25091a457f2..d22a0bcc79f 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/boss_drakos.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/boss_drakos.cpp @@ -52,141 +52,141 @@ enum DrakosEvents class boss_drakos : public CreatureScript { -public: - boss_drakos() : CreatureScript("boss_drakos") { } + public: + boss_drakos() : CreatureScript("boss_drakos") { } - CreatureAI* GetAI(Creature* creature) const OVERRIDE - { - return new boss_drakosAI(creature); - } - - struct boss_drakosAI : public BossAI - { - boss_drakosAI(Creature* creature) : BossAI(creature, DATA_DRAKOS_EVENT) { } - - void Reset() OVERRIDE + struct boss_drakosAI : public BossAI { - _Reset(); + boss_drakosAI(Creature* creature) : BossAI(creature, DATA_DRAKOS) { } - events.ScheduleEvent(EVENT_MAGIC_PULL, 15000); - events.ScheduleEvent(EVENT_STOMP, 17000); - events.ScheduleEvent(EVENT_BOMB_SUMMON, 2000); + void Reset() OVERRIDE + { + _Reset(); - postPull = false; - } + events.ScheduleEvent(EVENT_MAGIC_PULL, 15000); + events.ScheduleEvent(EVENT_STOMP, 17000); + events.ScheduleEvent(EVENT_BOMB_SUMMON, 2000); - void EnterCombat(Unit* /*who*/) OVERRIDE - { - _EnterCombat(); - Talk(SAY_AGGRO); - } + postPull = false; + } - void UpdateAI(uint32 diff) OVERRIDE - { - //Return since we have no target - if (!UpdateVictim()) - return; + void EnterCombat(Unit* /*who*/) OVERRIDE + { + _EnterCombat(); + Talk(SAY_AGGRO); + } - events.Update(diff); + void UpdateAI(uint32 diff) OVERRIDE + { + if (!UpdateVictim()) + return; - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); - while (uint32 eventId = events.ExecuteEvent()) - { - switch (eventId) - { - case EVENT_BOMB_SUMMON: - { - Position pPosition; - me->GetPosition(&pPosition); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - for (uint8 i = 0; i <= (postPull ? 3 : 0); i++) + while (uint32 eventId = events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_BOMB_SUMMON: { - me->GetRandomNearPosition(pPosition, float(urand(0, 10))); - me->SummonCreature(NPC_UNSTABLE_SPHERE, pPosition); + Position position; + me->GetPosition(&position); + + for (uint8 i = 0; i <= (postPull ? 3 : 0); i++) + { + me->GetRandomNearPosition(position, frand(0.0f, 10.0f)); + me->SummonCreature(NPC_UNSTABLE_SPHERE, position); + } } - } - events.ScheduleEvent(EVENT_BOMB_SUMMON, 2000); - break; - case EVENT_MAGIC_PULL: - DoCast(SPELL_MAGIC_PULL); - postPull = true; - events.ScheduleEvent(EVENT_MAGIC_PULL, 15000); - break; - case EVENT_STOMP: - Talk(SAY_STOMP); - DoCast(SPELL_THUNDERING_STOMP); - events.ScheduleEvent(EVENT_STOMP, 17000); - break; + events.ScheduleEvent(EVENT_BOMB_SUMMON, 2000); + break; + case EVENT_MAGIC_PULL: + DoCast(SPELL_MAGIC_PULL); + postPull = true; + events.ScheduleEvent(EVENT_MAGIC_PULL, 15000); + break; + case EVENT_STOMP: + Talk(SAY_STOMP); + DoCast(SPELL_THUNDERING_STOMP); + events.ScheduleEvent(EVENT_STOMP, 17000); + break; + default: + break; + } } + + DoMeleeAttackIfReady(); } - DoMeleeAttackIfReady(); - } + void JustDied(Unit* /*killer*/) OVERRIDE + { + _JustDied(); - void JustDied(Unit* /*killer*/) OVERRIDE - { - _JustDied(); + Talk(SAY_DEATH); - Talk(SAY_DEATH); + // start achievement timer (kill Eregos within 20 min) + instance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); + } - // start achievement timer (kill Eregos within 20 min) - instance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); - } + void KilledUnit(Unit* /*victim*/) OVERRIDE + { + Talk(SAY_KILL); + } + + private: + bool postPull; + }; - void KilledUnit(Unit* /*victim*/) OVERRIDE + CreatureAI* GetAI(Creature* creature) const OVERRIDE { - Talk(SAY_KILL); + return GetOculusAI<boss_drakosAI>(creature); } - private: - bool postPull; - }; }; class npc_unstable_sphere : public CreatureScript { -public: - npc_unstable_sphere() : CreatureScript("npc_unstable_sphere") { } + public: + npc_unstable_sphere() : CreatureScript("npc_unstable_sphere") { } - CreatureAI* GetAI(Creature* creature) const OVERRIDE - { - return new npc_unstable_sphereAI(creature); - } + struct npc_unstable_sphereAI : public ScriptedAI + { + npc_unstable_sphereAI(Creature* creature) : ScriptedAI(creature) { } - struct npc_unstable_sphereAI : public ScriptedAI - { - npc_unstable_sphereAI(Creature* creature) : ScriptedAI(creature) { } + void Reset() OVERRIDE + { + me->SetReactState(REACT_PASSIVE); + me->GetMotionMaster()->MoveRandom(40.0f); - void Reset() OVERRIDE - { - me->SetReactState(REACT_PASSIVE); - me->GetMotionMaster()->MoveRandom(40.0f); + me->AddAura(SPELL_UNSTABLE_SPHERE_PASSIVE, me); + me->AddAura(SPELL_UNSTABLE_SPHERE_TIMER, me); - me->AddAura(SPELL_UNSTABLE_SPHERE_PASSIVE, me); - me->AddAura(SPELL_UNSTABLE_SPHERE_TIMER, me); + pulseTimer = 3000; - pulseTimer = 3000; - deathTimer = 19000; - } + me->DespawnOrUnsummon(19000); + } - void UpdateAI(uint32 diff) OVERRIDE - { - if (pulseTimer <= diff) + void UpdateAI(uint32 diff) OVERRIDE { - DoCast(SPELL_UNSTABLE_SPHERE_PULSE); - pulseTimer = 3*IN_MILLISECONDS; - } else pulseTimer -= diff; + if (pulseTimer <= diff) + { + DoCast(SPELL_UNSTABLE_SPHERE_PULSE); + pulseTimer = 3 * IN_MILLISECONDS; + } + else + pulseTimer -= diff; + } - if (deathTimer <= diff) - me->DisappearAndDie(); - else deathTimer -= diff; - } - private: - uint32 pulseTimer; - uint32 deathTimer; - }; + private: + uint32 pulseTimer; + }; + CreatureAI* GetAI(Creature* creature) const OVERRIDE + { + return new npc_unstable_sphereAI(creature); + } }; void AddSC_boss_drakos() diff --git a/src/server/scripts/Northrend/Nexus/Oculus/boss_eregos.cpp b/src/server/scripts/Northrend/Nexus/Oculus/boss_eregos.cpp index abf0d6537c3..ca6f580633c 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/boss_eregos.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/boss_eregos.cpp @@ -21,8 +21,8 @@ #include "SpellAuraEffects.h" #include "oculus.h" -//Types of drake mounts: Ruby(Tank), Amber(DPS), Emerald(Healer) -//Two Repeating phases +// Types of drake mounts: Ruby (Tank), Amber (DPS), Emerald (Healer) +// Two Repeating phases enum Events { @@ -61,8 +61,8 @@ enum Npcs enum Phases { - PHASE_NORMAL = 1, - PHASE_FIRST_PLANAR = 2, + PHASE_NORMAL = 1, + PHASE_FIRST_PLANAR = 2, PHASE_SECOND_PLANAR = 3 }; @@ -80,172 +80,174 @@ enum EregosData class boss_eregos : public CreatureScript { -public: - boss_eregos() : CreatureScript("boss_eregos") { } - - CreatureAI* GetAI(Creature* creature) const OVERRIDE - { - return new boss_eregosAI(creature); - } - - struct boss_eregosAI : public BossAI - { - boss_eregosAI(Creature* creature) : BossAI(creature, DATA_EREGOS_EVENT) { } + public: + boss_eregos() : CreatureScript("boss_eregos") { } - void Reset() OVERRIDE + struct boss_eregosAI : public BossAI { - _Reset(); - _phase = PHASE_NORMAL; - - _rubyVoid = true; - _emeraldVoid = true; - _amberVoid = true; + boss_eregosAI(Creature* creature) : BossAI(creature, DATA_EREGOS) { } - DoAction(ACTION_SET_NORMAL_EVENTS); - } + void Reset() OVERRIDE + { + _Reset(); + _phase = PHASE_NORMAL; - void KilledUnit(Unit* /*victim*/) OVERRIDE - { - Talk(SAY_KILL); - } + _rubyVoid = true; + _emeraldVoid = true; + _amberVoid = true; - void EnterCombat(Unit* /*who*/) OVERRIDE - { - _EnterCombat(); - - Talk(SAY_AGGRO); - /* Checks for present drakes vehicles from each type and deactivate achievement that corresponds to each found - The checks are so big in case some party try weird things like pulling boss down or hiding out of check range, the only thing player need is to get the boss kill credit after the check /even if he or his drake die/ - Drakes mechanic would despawn all after unmount and also drakes should be auto mounted after item use, item use after Eregos is engaged leads to his despawn - based on retail data. */ - if (me->FindNearestCreature(NPC_RUBY_DRAKE_VEHICLE, 500.0f, true)) - _rubyVoid = false; - if (me->FindNearestCreature(NPC_EMERALD_DRAKE_VEHICLE, 500.0f, true)) - _emeraldVoid = false; - if (me->FindNearestCreature(NPC_AMBER_DRAKE_VEHICLE, 500.0f, true)) - _amberVoid = false; - } + DoAction(ACTION_SET_NORMAL_EVENTS); + } - uint32 GetData(uint32 type) const OVERRIDE - { - switch (type) - { - case DATA_RUBY_VOID: - return _rubyVoid; - case DATA_EMERALD_VOID: - return _emeraldVoid; - case DATA_AMBER_VOID: - return _amberVoid; - default: - break; + void KilledUnit(Unit* /*victim*/) OVERRIDE + { + Talk(SAY_KILL); } - return 0; - } - void DoAction(int32 action) OVERRIDE - { - if (action != ACTION_SET_NORMAL_EVENTS) - return; + void EnterCombat(Unit* /*who*/) OVERRIDE + { + _EnterCombat(); + + Talk(SAY_AGGRO); + /* Checks for present drakes vehicles from each type and deactivate achievement that corresponds to each found + The checks are so big in case some party try weird things like pulling boss down or hiding out of check range, the only thing player need is to get the boss kill credit after the check /even if he or his drake die/ + Drakes mechanic would despawn all after unmount and also drakes should be auto mounted after item use, item use after Eregos is engaged leads to his despawn - based on retail data. */ + if (me->FindNearestCreature(NPC_RUBY_DRAKE_VEHICLE, 500.0f, true)) + _rubyVoid = false; + if (me->FindNearestCreature(NPC_EMERALD_DRAKE_VEHICLE, 500.0f, true)) + _emeraldVoid = false; + if (me->FindNearestCreature(NPC_AMBER_DRAKE_VEHICLE, 500.0f, true)) + _amberVoid = false; + } - events.ScheduleEvent(EVENT_ARCANE_BARRAGE, urand(3, 10) * IN_MILLISECONDS, 0, PHASE_NORMAL); - events.ScheduleEvent(EVENT_ARCANE_VOLLEY, urand(10, 25) * IN_MILLISECONDS, 0, PHASE_NORMAL); - events.ScheduleEvent(EVENT_ENRAGED_ASSAULT, urand(35, 50) * IN_MILLISECONDS, 0, PHASE_NORMAL); - events.ScheduleEvent(EVENT_SUMMON_LEY_WHELP, urand(15, 30) * IN_MILLISECONDS, 0, PHASE_NORMAL); - } + uint32 GetData(uint32 type) const OVERRIDE + { + switch (type) + { + case DATA_RUBY_VOID: + return _rubyVoid; + case DATA_EMERALD_VOID: + return _emeraldVoid; + case DATA_AMBER_VOID: + return _amberVoid; + default: + break; + } + return 0; + } - void JustSummoned(Creature* summon) OVERRIDE - { - BossAI::JustSummoned(summon); + void DoAction(int32 action) OVERRIDE + { + if (action != ACTION_SET_NORMAL_EVENTS) + return; + + events.SetPhase(PHASE_NORMAL); + events.ScheduleEvent(EVENT_ARCANE_BARRAGE, urand(3, 10) * IN_MILLISECONDS, 0, PHASE_NORMAL); + events.ScheduleEvent(EVENT_ARCANE_VOLLEY, urand(10, 25) * IN_MILLISECONDS, 0, PHASE_NORMAL); + events.ScheduleEvent(EVENT_ENRAGED_ASSAULT, urand(35, 50) * IN_MILLISECONDS, 0, PHASE_NORMAL); + events.ScheduleEvent(EVENT_SUMMON_LEY_WHELP, urand(15, 30) * IN_MILLISECONDS, 0, PHASE_NORMAL); + } - if (summon->GetEntry() != NPC_PLANAR_ANOMALY) - return; + void JustSummoned(Creature* summon) OVERRIDE + { + BossAI::JustSummoned(summon); - summon->CombatStop(true); - summon->SetReactState(REACT_PASSIVE); - summon->GetMotionMaster()->MoveRandom(100.0f); - } + if (summon->GetEntry() != NPC_PLANAR_ANOMALY) + return; - void SummonedCreatureDespawn(Creature* summon) OVERRIDE - { - if (summon->GetEntry() != NPC_PLANAR_ANOMALY) - return; + summon->CombatStop(true); + summon->SetReactState(REACT_PASSIVE); + summon->GetMotionMaster()->MoveRandom(100.0f); + } - // TO-DO: See why the spell is not casted - summon->CastSpell(summon, SPELL_PLANAR_BLAST, true); - } + void SummonedCreatureDespawn(Creature* summon) OVERRIDE + { + if (summon->GetEntry() != NPC_PLANAR_ANOMALY) + return; - void DamageTaken(Unit* /*attacker*/, uint32& /*damage*/) OVERRIDE - { - if (!me->GetMap()->IsHeroic()) - return; + /// @todo: See why the spell is not casted + summon->CastSpell(summon, SPELL_PLANAR_BLAST, true); + } - if ( (me->GetHealthPct() < 60.0f && me->GetHealthPct() > 20.0f && _phase < PHASE_FIRST_PLANAR) - || (me->GetHealthPct() < 20.0f && _phase < PHASE_SECOND_PLANAR) ) + void DamageTaken(Unit* /*attacker*/, uint32& /*damage*/) OVERRIDE { - events.Reset(); - _phase = (me->GetHealthPct() < 60.0f && me->GetHealthPct() > 20.0f) ? PHASE_FIRST_PLANAR : PHASE_SECOND_PLANAR; + if (!IsHeroic()) + return; - Talk(SAY_SHIELD); - DoCast(SPELL_PLANAR_SHIFT); + if ( (me->GetHealthPct() < 60.0f && me->GetHealthPct() > 20.0f && _phase < PHASE_FIRST_PLANAR) + || (me->GetHealthPct() < 20.0f && _phase < PHASE_SECOND_PLANAR) ) + { + events.Reset(); + _phase = (me->GetHealthPct() < 60.0f && me->GetHealthPct() > 20.0f) ? PHASE_FIRST_PLANAR : PHASE_SECOND_PLANAR; - // not sure about the amount, and if we should despawn previous spawns (dragon trashs) - summons.DespawnAll(); - for (uint8 i = 0; i < 6; i++) - DoCast(SPELL_PLANAR_ANOMALIES); + Talk(SAY_SHIELD); + DoCast(SPELL_PLANAR_SHIFT); + + // not sure about the amount, and if we should despawn previous spawns (dragon trashs) + summons.DespawnAll(); + for (uint8 i = 0; i < 6; i++) + DoCast(SPELL_PLANAR_ANOMALIES); + } } - } - void UpdateAI(uint32 diff) OVERRIDE - { - //Return since we have no target - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) OVERRIDE + { + if (!UpdateVictim()) + return; - events.Update(diff); + events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - while (uint32 eventId = events.ExecuteEvent()) - { - switch (eventId) + while (uint32 eventId = events.ExecuteEvent()) { - case EVENT_ARCANE_BARRAGE: - DoCastVictim(SPELL_ARCANE_BARRAGE); - events.ScheduleEvent(EVENT_ARCANE_BARRAGE, urand(3, 10) * IN_MILLISECONDS, 0, PHASE_NORMAL); - break; - case EVENT_ARCANE_VOLLEY: - DoCastAOE(SPELL_ARCANE_VOLLEY); - events.ScheduleEvent(EVENT_ARCANE_VOLLEY, urand(10, 25) * IN_MILLISECONDS, 0, PHASE_NORMAL); - break; - case EVENT_ENRAGED_ASSAULT: - Talk(SAY_ENRAGE); - DoCast(SPELL_ENRAGED_ASSAULT); - events.ScheduleEvent(EVENT_ENRAGED_ASSAULT, urand(35, 50) * IN_MILLISECONDS, 0, PHASE_NORMAL); - break; - case EVENT_SUMMON_LEY_WHELP: - for (uint8 i = 0; i < 3; i++) - DoCast(SPELL_SUMMON_LEY_WHELP); - events.ScheduleEvent(EVENT_SUMMON_LEY_WHELP, urand(15, 30) * IN_MILLISECONDS, 0, PHASE_NORMAL); - break; + switch (eventId) + { + case EVENT_ARCANE_BARRAGE: + DoCastVictim(SPELL_ARCANE_BARRAGE); + events.ScheduleEvent(EVENT_ARCANE_BARRAGE, urand(3, 10) * IN_MILLISECONDS, 0, PHASE_NORMAL); + break; + case EVENT_ARCANE_VOLLEY: + DoCastAOE(SPELL_ARCANE_VOLLEY); + events.ScheduleEvent(EVENT_ARCANE_VOLLEY, urand(10, 25) * IN_MILLISECONDS, 0, PHASE_NORMAL); + break; + case EVENT_ENRAGED_ASSAULT: + Talk(SAY_ENRAGE); + DoCast(SPELL_ENRAGED_ASSAULT); + events.ScheduleEvent(EVENT_ENRAGED_ASSAULT, urand(35, 50) * IN_MILLISECONDS, 0, PHASE_NORMAL); + break; + case EVENT_SUMMON_LEY_WHELP: + for (uint8 i = 0; i < 3; i++) + DoCast(SPELL_SUMMON_LEY_WHELP); + events.ScheduleEvent(EVENT_SUMMON_LEY_WHELP, urand(15, 30) * IN_MILLISECONDS, 0, PHASE_NORMAL); + break; + default: + break; + } } + + DoMeleeAttackIfReady(); } - DoMeleeAttackIfReady(); - } + void JustDied(Unit* /*killer*/) OVERRIDE + { + Talk(SAY_DEATH); - void JustDied(Unit* /*killer*/) OVERRIDE - { - Talk(SAY_DEATH); + _JustDied(); + } - _JustDied(); - } + private: + uint8 _phase; + bool _rubyVoid; + bool _emeraldVoid; + bool _amberVoid; + }; - private: - uint8 _phase; - bool _rubyVoid; - bool _emeraldVoid; - bool _amberVoid; - }; + CreatureAI* GetAI(Creature* creature) const OVERRIDE + { + return new boss_eregosAI(creature); + } }; class spell_eregos_planar_shift : public SpellScriptLoader @@ -259,9 +261,8 @@ class spell_eregos_planar_shift : public SpellScriptLoader void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - if (Unit* caster = GetCaster()) - if (Creature* creatureCaster = caster->ToCreature()) - creatureCaster->AI()->DoAction(ACTION_SET_NORMAL_EVENTS); + if (Creature* creature = GetTarget()->ToCreature()) + creature->AI()->DoAction(ACTION_SET_NORMAL_EVENTS); } void Register() OVERRIDE diff --git a/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp b/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp index 678748b1f01..f7c558879d1 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp @@ -29,7 +29,6 @@ EndScriptData */ enum Spells { - SPELL_ARCANE_SHIELD = 53813, //Dummy --> Channeled, shields the caster from damage. SPELL_EMPOWERED_ARCANE_EXPLOSION = 51110, SPELL_EMPOWERED_ARCANE_EXPLOSION_2 = 59377, @@ -89,274 +88,242 @@ static uint32 TeleportSpells[]= class boss_urom : public CreatureScript { -public: - boss_urom() : CreatureScript("boss_urom") { } - - CreatureAI* GetAI(Creature* creature) const OVERRIDE - { - return new boss_uromAI(creature); - } - - struct boss_uromAI : public BossAI - { - boss_uromAI(Creature* creature) : BossAI(creature, DATA_UROM_EVENT) { } + public: + boss_urom() : CreatureScript("boss_urom") { } - void Reset() OVERRIDE + struct boss_uromAI : public BossAI { - me->CastSpell(me, SPELL_EVOCATE); - - _Reset(); - - if (instance->GetData(DATA_UROM_PLATAFORM) == 0) + boss_uromAI(Creature* creature) : BossAI(creature, DATA_UROM) { - for (uint8 i = 0; i < 3; i++) - group[i] = 0; - } + platform = 0; - x = 0.0f; - y = 0.0f; - canCast = false; - canGoBack = false; + for (uint8 i = 0; i < 3; ++i) + group[i] = i; - me->GetMotionMaster()->MoveIdle(); - - teleportTimer = urand(30000, 35000); - arcaneExplosionTimer = 9000; - castArcaneExplosionTimer = 2000; - frostBombTimer = urand(5000, 8000); - timeBombTimer = urand(20000, 25000); - } + std::random_shuffle(group, group + 3); + } - void EnterCombat(Unit* /*who*/) OVERRIDE - { - _EnterCombat(); + void Reset() OVERRIDE + { + me->CastSpell(me, SPELL_EVOCATE); - SetGroups(); - SummonGroups(); - CastTeleport(); + _Reset(); - if (instance->GetData(DATA_UROM_PLATAFORM) != 3) - instance->SetData(DATA_UROM_PLATAFORM, instance->GetData(DATA_UROM_PLATAFORM)+1); - } + x = 0.0f; + y = 0.0f; + canCast = false; + canGoBack = false; - void AttackStart(Unit* who) OVERRIDE - { - if (!who) - return; + me->GetMotionMaster()->MoveIdle(); - if (me->GetPositionZ() > 518.63f) - DoStartNoMovement(who); + teleportTimer = urand(30000, 35000); + arcaneExplosionTimer = 9000; + castArcaneExplosionTimer = 2000; + frostBombTimer = urand(5000, 8000); + timeBombTimer = urand(20000, 25000); + } - if (me->GetPositionZ() < 518.63f) + void EnterCombat(Unit* /*who*/) OVERRIDE { - if (me->Attack(who, true)) - { - Talk(SAY_AGGRO); - - me->SetInCombatWith(who); - who->SetInCombatWith(me); + _EnterCombat(); - me->GetMotionMaster()->MoveChase(who, 0, 0); - } + StartAttack(); } - } - - void SetGroups() - { - if (!instance || instance->GetData(DATA_UROM_PLATAFORM) != 0) - return; - while (group[0] == group[1] || group[0] == group[2] || group[1] == group[2]) + void AttackStart(Unit* who) OVERRIDE { - for (uint8 i = 0; i < 3; i++) - group[i] = urand(0, 2); - } - } + if (!who) + return; - void SetPosition(uint8 i) - { - switch (i) - { - case 0: - x = me->GetPositionX() + 4; - y = me->GetPositionY() - 4; - break; - case 1: - x = me->GetPositionX() + 4; - y = me->GetPositionY() + 4; - break; - case 2: - x = me->GetPositionX() - 4; - y = me->GetPositionY() + 4; - break; - case 3: - x = me->GetPositionX() - 4; - y = me->GetPositionY() - 4; - break; - default: - break; + if (me->GetPositionZ() > 518.63f) + DoStartNoMovement(who); + else + BossAI::AttackStart(who); } - } - void SummonGroups() - { - if (!instance || instance->GetData(DATA_UROM_PLATAFORM) > 2) - return; - - for (uint8 i = 0; i < 4; i++) + void SetPosition(uint8 i) { - SetPosition(i); - me->SummonCreature(Group[group[instance->GetData(DATA_UROM_PLATAFORM)]].entry[i], x, y, me->GetPositionZ(), me->GetOrientation()); - - // teleport to next platform and spawn adds - switch (instance->GetData(DATA_UROM_PLATAFORM)) + switch (i) { + case 0: + x = me->GetPositionX() + 4; + y = me->GetPositionY() - 4; + break; case 1: - Talk(SAY_SUMMON_1); + x = me->GetPositionX() + 4; + y = me->GetPositionY() + 4; break; case 2: - Talk(SAY_SUMMON_2); + x = me->GetPositionX() - 4; + y = me->GetPositionY() + 4; break; case 3: - Talk(SAY_SUMMON_3); + x = me->GetPositionX() - 4; + y = me->GetPositionY() - 4; break; default: break; } } - } - void CastTeleport() - { - if (!instance || instance->GetData(DATA_UROM_PLATAFORM) > 2) - return; - - Talk(instance->GetData(DATA_UROM_PLATAFORM) < 5 ? instance->GetData(DATA_UROM_PLATAFORM) : 0); - DoCast(TeleportSpells[instance->GetData(DATA_UROM_PLATAFORM)]); - } - - void KilledUnit(Unit* /*victim*/) OVERRIDE - { - Talk(SAY_PLAYER_KILL); - } - - void UpdateAI(uint32 uiDiff) OVERRIDE - { - if (!UpdateVictim()) - return; + void StartAttack() + { + if (platform > 2) + { + Talk(SAY_AGGRO); + return; + } - if (!instance || instance->GetData(DATA_UROM_PLATAFORM) < 2) - return; + // summon guards and jump to next platform + for (uint8 i = 0; i < 4; ++i) + { + SetPosition(i); + me->SummonCreature(Group[group[platform]].entry[i], x, y, me->GetPositionZ(), me->GetOrientation()); + } - if (teleportTimer <= uiDiff) - { - me->InterruptNonMeleeSpells(false); - me->GetMotionMaster()->MoveIdle(); - DoCast(SPELL_TELEPORT); - teleportTimer = urand(30000, 35000); + Talk(platform); + DoCast(TeleportSpells[platform]); - } else teleportTimer -= uiDiff; + ++platform; + } - if (canCast && !me->FindCurrentSpellBySpellId(SPELL_EMPOWERED_ARCANE_EXPLOSION)) + void KilledUnit(Unit* who) OVERRIDE { - if (castArcaneExplosionTimer <= uiDiff) - { - canCast = false; - canGoBack = true; - DoCastAOE(SPELL_EMPOWERED_ARCANE_EXPLOSION); - castArcaneExplosionTimer = 2000; - }else castArcaneExplosionTimer -= uiDiff; + if (who->GetTypeId() == TYPEID_PLAYER) + Talk(SAY_PLAYER_KILL); } - if (canGoBack) + void UpdateAI(uint32 diff) OVERRIDE { - if (arcaneExplosionTimer <= uiDiff) - { - Position pPos; - me->GetVictim()->GetPosition(&pPos); + if (!UpdateVictim()) + return; - me->NearTeleportTo(pPos.GetPositionX(), pPos.GetPositionY(), pPos.GetPositionZ(), pPos.GetOrientation()); - me->GetMotionMaster()->MoveChase(me->GetVictim(), 0, 0); - me->SetWalk(true); + if (platform < 3) + return; - Talk(EMOTE_ARCANE_EXPLOSION); - Talk(SAY_ARCANE_EXPLOSION); + events.Update(diff); - canCast = false; - canGoBack = false; - arcaneExplosionTimer = 9000; - } else arcaneExplosionTimer -= uiDiff; - } + if (teleportTimer <= diff) + { + me->InterruptNonMeleeSpells(false); + me->GetMotionMaster()->MoveIdle(); + DoCast(SPELL_TELEPORT); + teleportTimer = urand(30000, 35000); + } + else + teleportTimer -= diff; - if (!me->IsNonMeleeSpellCasted(false, true, true)) - { - if (frostBombTimer <= uiDiff) + if (canCast && !me->FindCurrentSpellBySpellId(SPELL_EMPOWERED_ARCANE_EXPLOSION)) { - DoCastVictim(SPELL_FROSTBOMB); - frostBombTimer = urand(5000, 8000); - } else frostBombTimer -= uiDiff; + if (castArcaneExplosionTimer <= diff) + { + canCast = false; + canGoBack = true; + DoCastAOE(SPELL_EMPOWERED_ARCANE_EXPLOSION); + castArcaneExplosionTimer = 2000; + } + else + castArcaneExplosionTimer -= diff; + } - if (timeBombTimer <= uiDiff) + if (canGoBack) { - if (Unit* unit = SelectTarget(SELECT_TARGET_RANDOM)) - DoCast(unit, SPELL_TIME_BOMB); + if (arcaneExplosionTimer <= diff) + { + Position pos; + me->GetVictim()->GetPosition(&pos); + + me->NearTeleportTo(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation()); + me->GetMotionMaster()->MoveChase(me->GetVictim()); + me->SetWalk(true); + + Talk(EMOTE_ARCANE_EXPLOSION); + Talk(SAY_ARCANE_EXPLOSION); + + canCast = false; + canGoBack = false; + arcaneExplosionTimer = 9000; + } + else + arcaneExplosionTimer -= diff; + } - timeBombTimer = urand(20000, 25000); - } else timeBombTimer -= uiDiff; - } + if (!me->IsNonMeleeSpellCasted(false, true, true)) + { + if (frostBombTimer <= diff) + { + DoCastVictim(SPELL_FROSTBOMB); + frostBombTimer = urand(5000, 8000); + } + else + frostBombTimer -= diff; + + if (timeBombTimer <= diff) + { + if (Unit* unit = SelectTarget(SELECT_TARGET_RANDOM)) + DoCast(unit, SPELL_TIME_BOMB); + + timeBombTimer = urand(20000, 25000); + } + else + timeBombTimer -= diff; + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - void JustDied(Unit* /*killer*/) OVERRIDE - { - _JustDied(); - Talk(SAY_DEATH); - DoCast(me, SPELL_DEATH_SPELL, true); // we cast the spell as triggered or the summon effect does not occur - } + void JustDied(Unit* /*killer*/) OVERRIDE + { + _JustDied(); + Talk(SAY_DEATH); + DoCast(me, SPELL_DEATH_SPELL, true); // we cast the spell as triggered or the summon effect does not occur + } - void LeaveCombat() - { - me->RemoveAllAuras(); - me->CombatStop(false); - me->DeleteThreatList(); - } + void LeaveCombat() + { + me->RemoveAllAuras(); + me->CombatStop(false); + me->DeleteThreatList(); + } - void SpellHit(Unit* /*pCaster*/, const SpellInfo* pSpell) OVERRIDE - { - switch (pSpell->Id) + void SpellHit(Unit* /*caster*/, SpellInfo const* spellInfo) OVERRIDE { - case SPELL_SUMMON_MENAGERIE: - me->SetHomePosition(968.66f, 1042.53f, 527.32f, 0.077f); - LeaveCombat(); - me->CastSpell(me, SPELL_EVOCATE); - break; - case SPELL_SUMMON_MENAGERIE_2: - me->SetHomePosition(1164.02f, 1170.85f, 527.321f, 3.66f); - LeaveCombat(); - me->CastSpell(me, SPELL_EVOCATE); - break; - case SPELL_SUMMON_MENAGERIE_3: - me->SetHomePosition(1118.31f, 1080.377f, 508.361f, 4.25f); - LeaveCombat(); - me->CastSpell(me, SPELL_EVOCATE); - break; - case SPELL_TELEPORT: - //! Unconfirmed, previous below - me->SetDisableGravity(true); - //me->AddUnitMovementFlag(MOVEMENTFLAG_CAN_FLY); // with out it the npc will fall down while is casting - canCast = true; - break; - default: - break; + switch (spellInfo->Id) + { + case SPELL_SUMMON_MENAGERIE: + me->SetHomePosition(968.66f, 1042.53f, 527.32f, 0.077f); + LeaveCombat(); + me->CastSpell(me, SPELL_EVOCATE); + break; + case SPELL_SUMMON_MENAGERIE_2: + me->SetHomePosition(1164.02f, 1170.85f, 527.321f, 3.66f); + LeaveCombat(); + me->CastSpell(me, SPELL_EVOCATE); + break; + case SPELL_SUMMON_MENAGERIE_3: + me->SetHomePosition(1118.31f, 1080.377f, 508.361f, 4.25f); + LeaveCombat(); + me->CastSpell(me, SPELL_EVOCATE); + break; + case SPELL_TELEPORT: + //! Unconfirmed, previous below + me->SetDisableGravity(true); + //me->AddUnitMovementFlag(MOVEMENTFLAG_CAN_FLY); // with out it the npc will fall down while is casting + canCast = true; + break; + default: + break; + } } - } + private: float x, y; bool canCast; bool canGoBack; + uint8 platform; + uint8 group[3]; uint32 teleportTimer; @@ -364,7 +331,12 @@ public: uint32 castArcaneExplosionTimer; uint32 frostBombTimer; uint32 timeBombTimer; - }; + }; + + CreatureAI* GetAI(Creature* creature) const OVERRIDE + { + return GetOculusAI<boss_uromAI>(creature); + } }; void AddSC_boss_urom() diff --git a/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp b/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp index bc72c808a6f..385f80ae37d 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp @@ -54,105 +54,111 @@ enum Events class boss_varos : public CreatureScript { -public: - boss_varos() : CreatureScript("boss_varos") { } - - CreatureAI* GetAI(Creature* creature) const OVERRIDE - { - return new boss_varosAI(creature); - } + public: + boss_varos() : CreatureScript("boss_varos") { } - struct boss_varosAI : public BossAI - { - boss_varosAI(Creature* creature) : BossAI(creature, DATA_VAROS_EVENT) + struct boss_varosAI : public BossAI { - if (instance->GetBossState(DATA_DRAKOS_EVENT) != DONE) - DoCast(me, SPELL_CENTRIFUGE_SHIELD); - } + boss_varosAI(Creature* creature) : BossAI(creature, DATA_VAROS) { } - void Reset() OVERRIDE - { - _Reset(); + void InitializeAI() OVERRIDE + { + BossAI::InitializeAI(); + if (instance->GetBossState(DATA_DRAKOS) != DONE) + DoCast(me, SPELL_CENTRIFUGE_SHIELD); + } - events.ScheduleEvent(EVENT_AMPLIFY_MAGIC, urand(20, 25) * IN_MILLISECONDS); - events.ScheduleEvent(EVENT_ENERGIZE_CORES_VISUAL, 5000); - // not sure if this is handled by a timer or hp percentage - events.ScheduleEvent(EVENT_CALL_AZURE, urand(15, 30) * IN_MILLISECONDS); + void Reset() OVERRIDE + { + _Reset(); - firstCoreEnergize = false; - coreEnergizeOrientation = 0.0f; - } + events.ScheduleEvent(EVENT_AMPLIFY_MAGIC, urand(20, 25) * IN_MILLISECONDS); + events.ScheduleEvent(EVENT_ENERGIZE_CORES_VISUAL, 5000); + // not sure if this is handled by a timer or hp percentage + events.ScheduleEvent(EVENT_CALL_AZURE, urand(15, 30) * IN_MILLISECONDS); - void EnterCombat(Unit* /*who*/) OVERRIDE - { - _EnterCombat(); + firstCoreEnergize = false; + coreEnergizeOrientation = 0.0f; + } - Talk(SAY_AGGRO); - } + void EnterCombat(Unit* /*who*/) OVERRIDE + { + _EnterCombat(); - float GetCoreEnergizeOrientation() - { - return coreEnergizeOrientation; - } + Talk(SAY_AGGRO); + } - void UpdateAI(uint32 diff) OVERRIDE - { - //Return since we have no target - if (!UpdateVictim()) - return; + float GetCoreEnergizeOrientation() + { + return coreEnergizeOrientation; + } - events.Update(diff); + void UpdateAI(uint32 diff) OVERRIDE + { + if (!UpdateVictim()) + return; - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); - while (uint32 eventId = events.ExecuteEvent()) - { - switch (eventId) + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; + + while (uint32 eventId = events.ExecuteEvent()) { - case EVENT_ENERGIZE_CORES: - DoCast(me, SPELL_ENERGIZE_CORES); - events.CancelEvent(EVENT_ENERGIZE_CORES); - break; - case EVENT_ENERGIZE_CORES_VISUAL: - if (!firstCoreEnergize) - { - coreEnergizeOrientation = me->GetOrientation(); - firstCoreEnergize = true; - } else - coreEnergizeOrientation = Position::NormalizeOrientation(coreEnergizeOrientation - 2.0f); - - DoCast(me, SPELL_ENERGIZE_CORES_VISUAL); - events.ScheduleEvent(EVENT_ENERGIZE_CORES_VISUAL, 5000); - events.ScheduleEvent(EVENT_ENERGIZE_CORES, 4000); - break; - case EVENT_CALL_AZURE: - // not sure how blizz handles this, i cant see any pattern between the differnt spells - DoCast(me, SPELL_CALL_AZURE_RING_CAPTAIN); - Talk(SAY_AZURE); - Talk(SAY_AZURE_EMOTE); - events.ScheduleEvent(EVENT_CALL_AZURE, urand(20, 25) * IN_MILLISECONDS); - break; - case EVENT_AMPLIFY_MAGIC: - DoCastVictim(SPELL_CALL_AMPLIFY_MAGIC); - events.ScheduleEvent(EVENT_AMPLIFY_MAGIC, urand(17, 20) * IN_MILLISECONDS); - break; + switch (eventId) + { + case EVENT_ENERGIZE_CORES: + DoCast(me, SPELL_ENERGIZE_CORES); + events.CancelEvent(EVENT_ENERGIZE_CORES); + break; + case EVENT_ENERGIZE_CORES_VISUAL: + if (!firstCoreEnergize) + { + coreEnergizeOrientation = me->GetOrientation(); + firstCoreEnergize = true; + } + else + coreEnergizeOrientation = Position::NormalizeOrientation(coreEnergizeOrientation - 2.0f); + + DoCast(me, SPELL_ENERGIZE_CORES_VISUAL); + events.ScheduleEvent(EVENT_ENERGIZE_CORES_VISUAL, 5000); + events.ScheduleEvent(EVENT_ENERGIZE_CORES, 4000); + break; + case EVENT_CALL_AZURE: + // not sure how blizz handles this, i cant see any pattern between the differnt spells + DoCast(me, SPELL_CALL_AZURE_RING_CAPTAIN); + Talk(SAY_AZURE); + Talk(SAY_AZURE_EMOTE); + events.ScheduleEvent(EVENT_CALL_AZURE, urand(20, 25) * IN_MILLISECONDS); + break; + case EVENT_AMPLIFY_MAGIC: + DoCastVictim(SPELL_CALL_AMPLIFY_MAGIC); + events.ScheduleEvent(EVENT_AMPLIFY_MAGIC, urand(17, 20) * IN_MILLISECONDS); + break; + default: + break; + } } + + DoMeleeAttackIfReady(); } - DoMeleeAttackIfReady(); - } + void JustDied(Unit* /*killer*/) OVERRIDE + { + _JustDied(); + Talk(SAY_DEATH); + DoCast(me, SPELL_DEATH_SPELL, true); // we cast the spell as triggered or the summon effect does not occur + } - void JustDied(Unit* /*killer*/) OVERRIDE + private: + bool firstCoreEnergize; + float coreEnergizeOrientation; + }; + + CreatureAI* GetAI(Creature* creature) const OVERRIDE { - _JustDied(); - Talk(SAY_DEATH); - DoCast(me, SPELL_DEATH_SPELL, true); // we cast the spell as triggered or the summon effect does not occur + return GetOculusAI<boss_varosAI>(creature); } - private: - bool firstCoreEnergize; - float coreEnergizeOrientation; - }; }; class npc_azure_ring_captain : public CreatureScript @@ -259,7 +265,6 @@ class spell_varos_centrifuge_shield : public SpellScriptLoader if (Unit* caster = GetCaster()) { // flags taken from sniffs - // UNIT_FLAG_UNK_9 -> means passive but it is not yet implemented in core if (caster->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_15|UNIT_FLAG_IMMUNE_TO_NPC|UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_UNK_6)) { caster->ToCreature()->SetReactState(REACT_PASSIVE); diff --git a/src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp b/src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp index 70424119a0a..b108378910e 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp @@ -18,354 +18,336 @@ #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "InstanceScript.h" +#include "WorldPacket.h" #include "oculus.h" -#include "Player.h" -#define MAX_ENCOUNTER 4 +DoorData const doorData[] = +{ + { GO_DRAGON_CAGE_DOOR, DATA_DRAKOS, DOOR_TYPE_PASSAGE, BOUNDARY_NONE }, + { 0, 0, DOOR_TYPE_ROOM, BOUNDARY_NONE } +}; -/* The Occulus encounters: -0 - Drakos the Interrogator -1 - Varos Cloudstrider -2 - Mage-Lord Urom -3 - Ley-Guardian Eregos */ +Position const VerdisaMove = { 949.188f, 1032.91f, 359.967f, 1.093027f }; +Position const BelgaristraszMove = { 941.453f, 1044.1f, 359.967f, 0.1984709f }; +Position const EternosMove = { 943.202f, 1059.35f, 359.967f, 5.757278f }; class instance_oculus : public InstanceMapScript { -public: - instance_oculus() : InstanceMapScript("instance_oculus", 578) { } - - InstanceScript* GetInstanceScript(InstanceMap* map) const OVERRIDE - { - return new instance_oculus_InstanceMapScript(map); - } - - struct instance_oculus_InstanceMapScript : public InstanceScript - { - instance_oculus_InstanceMapScript(Map* map) : InstanceScript(map) { } + public: + instance_oculus() : InstanceMapScript(OculusScriptName, 578) { } - void Initialize() OVERRIDE + struct instance_oculus_InstanceMapScript : public InstanceScript { - SetBossNumber(MAX_ENCOUNTER); - - drakosGUID = 0; - varosGUID = 0; - uromGUID = 0; - eregosGUID = 0; - - platformUrom = 0; - centrifugueConstructCounter = 0; - - eregosCacheGUID = 0; - - gwhelpList.clear(); - gameObjectList.clear(); + instance_oculus_InstanceMapScript(Map* map) : InstanceScript(map) + { + SetBossNumber(EncounterCount); + LoadDoorData(doorData); - belgaristraszGUID = 0; - eternosGUID = 0; - verdisaGUID = 0; -} + DrakosGUID = 0; + VarosGUID = 0; + UromGUID = 0; + EregosGUID = 0; - void OnUnitDeath(Unit* unit) OVERRIDE - { - Creature* creature = unit->ToCreature(); - if (!creature) - return; + CentrifugueConstructCounter = 0; - if (creature->GetEntry() != NPC_CENTRIFUGE_CONSTRUCT) - return; + EregosCacheGUID = 0; - DoUpdateWorldState(WORLD_STATE_CENTRIFUGE_CONSTRUCT_AMOUNT, --centrifugueConstructCounter); + GreaterWhelpList.clear(); - if (!centrifugueConstructCounter) - if (Creature* varos = instance->GetCreature(varosGUID)) - varos->RemoveAllAuras(); - } + BelgaristraszGUID = 0; + EternosGUID = 0; + VerdisaGUID = 0; + } - void OnPlayerEnter(Player* player) OVERRIDE - { - if (GetBossState(DATA_DRAKOS_EVENT) == DONE && GetBossState(DATA_VAROS_EVENT) != DONE) + void OnCreatureCreate(Creature* creature) OVERRIDE { - player->SendUpdateWorldState(WORLD_STATE_CENTRIFUGE_CONSTRUCT_SHOW, 1); - player->SendUpdateWorldState(WORLD_STATE_CENTRIFUGE_CONSTRUCT_AMOUNT, centrifugueConstructCounter); - } else + switch (creature->GetEntry()) + { + case NPC_DRAKOS: + DrakosGUID = creature->GetGUID(); + break; + case NPC_VAROS: + VarosGUID = creature->GetGUID(); + if (GetBossState(DATA_DRAKOS) == DONE) + creature->SetPhaseMask(1, true); + break; + case NPC_UROM: + UromGUID = creature->GetGUID(); + if (GetBossState(DATA_VAROS) == DONE) + creature->SetPhaseMask(1, true); + break; + case NPC_EREGOS: + EregosGUID = creature->GetGUID(); + if (GetBossState(DATA_UROM) == DONE) + creature->SetPhaseMask(1, true); + break; + case NPC_CENTRIFUGE_CONSTRUCT: + if (creature->IsAlive()) + DoUpdateWorldState(WORLD_STATE_CENTRIFUGE_CONSTRUCT_AMOUNT, ++CentrifugueConstructCounter); + break; + case NPC_BELGARISTRASZ: + BelgaristraszGUID = creature->GetGUID(); + if (GetBossState(DATA_DRAKOS) == DONE) + { + creature->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + creature->Relocate(BelgaristraszMove); + } + break; + case NPC_ETERNOS: + EternosGUID = creature->GetGUID(); + if (GetBossState(DATA_DRAKOS) == DONE) + { + creature->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + creature->Relocate(EternosMove); + } + break; + case NPC_VERDISA: + VerdisaGUID = creature->GetGUID(); + if (GetBossState(DATA_DRAKOS) == DONE) + { + creature->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + creature->Relocate(VerdisaMove); + } + break; + case NPC_GREATER_WHELP: + if (GetBossState(DATA_UROM) == DONE) + { + creature->SetPhaseMask(1, true); + GreaterWhelpList.push_back(creature->GetGUID()); + } + break; + default: + break; + } + } + + void OnGameObjectCreate(GameObject* go) OVERRIDE { - player->SendUpdateWorldState(WORLD_STATE_CENTRIFUGE_CONSTRUCT_SHOW, 0); - player->SendUpdateWorldState(WORLD_STATE_CENTRIFUGE_CONSTRUCT_AMOUNT, 0); + switch (go->GetEntry()) + { + case GO_DRAGON_CAGE_DOOR: + AddDoor(go, true); + break; + case GO_EREGOS_CACHE_N: + case GO_EREGOS_CACHE_H: + EregosCacheGUID = go->GetGUID(); + break; + default: + break; + } } - } - void ProcessEvent(WorldObject* /*unit*/, uint32 eventId) - { - if (eventId != EVENT_CALL_DRAGON) - return; + void OnGameObjectRemove(GameObject* go) OVERRIDE + { + switch (go->GetEntry()) + { + case GO_DRAGON_CAGE_DOOR: + AddDoor(go, false); + break; + default: + break; + } + } - Creature* varos = instance->GetCreature(varosGUID); + void OnUnitDeath(Unit* unit) OVERRIDE + { + Creature* creature = unit->ToCreature(); + if (!creature) + return; - if (!varos) - return; + if (creature->GetEntry() == NPC_CENTRIFUGE_CONSTRUCT) + { + DoUpdateWorldState(WORLD_STATE_CENTRIFUGE_CONSTRUCT_AMOUNT, --CentrifugueConstructCounter); - if (Creature* drake = varos->SummonCreature(NPC_AZURE_RING_GUARDIAN, varos->GetPositionX(), varos->GetPositionY(), varos->GetPositionZ()+40)) - drake->AI()->DoAction(ACTION_CALL_DRAGON_EVENT); - } + if (!CentrifugueConstructCounter) + if (Creature* varos = instance->GetCreature(VarosGUID)) + varos->RemoveAllAuras(); + } + } - void OnCreatureCreate(Creature* creature) OVERRIDE - { - switch (creature->GetEntry()) + void FillInitialWorldStates(WorldPacket& data) OVERRIDE { - case NPC_DRAKOS: - drakosGUID = creature->GetGUID(); - break; - case NPC_VAROS: - varosGUID = creature->GetGUID(); - if (GetBossState(DATA_DRAKOS_EVENT) == DONE) - creature->SetPhaseMask(1, true); - break; - case NPC_UROM: - uromGUID = creature->GetGUID(); - if (GetBossState(DATA_VAROS_EVENT) == DONE) - creature->SetPhaseMask(1, true); - break; - case NPC_EREGOS: - eregosGUID = creature->GetGUID(); - if (GetBossState(DATA_UROM_EVENT) == DONE) - creature->SetPhaseMask(1, true); - break; - case NPC_CENTRIFUGE_CONSTRUCT: - if (creature->IsAlive()) - DoUpdateWorldState(WORLD_STATE_CENTRIFUGE_CONSTRUCT_AMOUNT, ++centrifugueConstructCounter); - break; - case NPC_BELGARISTRASZ: - belgaristraszGUID = creature->GetGUID(); - if (GetBossState(DATA_DRAKOS_EVENT) == DONE) - { - creature->SetWalk(true), - creature->GetMotionMaster()->MovePoint(0, 941.453f, 1044.1f, 359.967f), - creature->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - } - break; - case NPC_ETERNOS: - eternosGUID = creature->GetGUID(); - if (GetBossState(DATA_DRAKOS_EVENT) == DONE) - { - creature->SetWalk(true), - creature->GetMotionMaster()->MovePoint(0, 943.202f, 1059.35f, 359.967f), - creature->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - } - break; - case NPC_VERDISA: - verdisaGUID = creature->GetGUID(); - if (GetBossState(DATA_DRAKOS_EVENT) == DONE) - { - creature->SetWalk(true), - creature->GetMotionMaster()->MovePoint(0, 949.188f, 1032.91f, 359.967f), - creature->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - } - break; - case NPC_GREATER_WHELP: - if (GetBossState(DATA_UROM_EVENT) == DONE) - { - creature->SetPhaseMask(1, true); - gwhelpList.push_back(creature->GetGUID()); - } - break; + if (GetBossState(DATA_DRAKOS) == DONE && GetBossState(DATA_VAROS) != DONE) + { + data << uint32(WORLD_STATE_CENTRIFUGE_CONSTRUCT_SHOW) << uint32(1); + data << uint32(WORLD_STATE_CENTRIFUGE_CONSTRUCT_AMOUNT) << uint32(CentrifugueConstructCounter); + } + else + { + data << uint32(WORLD_STATE_CENTRIFUGE_CONSTRUCT_SHOW) << uint32(0); + data << uint32(WORLD_STATE_CENTRIFUGE_CONSTRUCT_AMOUNT) << uint32(0); + } } - } - void OnGameObjectCreate(GameObject* go) OVERRIDE - { - switch (go->GetEntry()) + void ProcessEvent(WorldObject* /*unit*/, uint32 eventId) OVERRIDE { - case GO_DRAGON_CAGE_DOOR: - if (GetBossState(DATA_DRAKOS_EVENT) == DONE) - go->SetGoState(GO_STATE_ACTIVE); - else - go->SetGoState(GO_STATE_READY); - gameObjectList.push_back(go->GetGUID()); - break; - case GO_EREGOS_CACHE_N: - case GO_EREGOS_CACHE_H: - eregosCacheGUID = go->GetGUID(); - break; - default: - break; - } - } + if (eventId != EVENT_CALL_DRAGON) + return; - bool SetBossState(uint32 type, EncounterState state) OVERRIDE - { - if (!InstanceScript::SetBossState(type, state)) - return false; + if (Creature* varos = instance->GetCreature(VarosGUID)) + if (Creature* drake = varos->SummonCreature(NPC_AZURE_RING_GUARDIAN, varos->GetPositionX(), varos->GetPositionY(), varos->GetPositionZ() + 40)) + drake->AI()->DoAction(ACTION_CALL_DRAGON_EVENT); + } - switch (type) + bool SetBossState(uint32 type, EncounterState state) OVERRIDE { - case DATA_DRAKOS_EVENT: - if (state == DONE) - { - DoUpdateWorldState(WORLD_STATE_CENTRIFUGE_CONSTRUCT_SHOW, 1); - DoUpdateWorldState(WORLD_STATE_CENTRIFUGE_CONSTRUCT_AMOUNT, centrifugueConstructCounter); - OpenCageDoors(); - FreeDragons(); - if (Creature* varos = instance->GetCreature(varosGUID)) - varos->SetPhaseMask(1, true); - } - break; - case DATA_VAROS_EVENT: - if (state == DONE) - DoUpdateWorldState(WORLD_STATE_CENTRIFUGE_CONSTRUCT_SHOW, 0); - if (Creature* urom = instance->GetCreature(uromGUID)) - urom->SetPhaseMask(1, true); - break; - case DATA_UROM_EVENT: - if (state == DONE) - { - if (Creature* eregos = instance->GetCreature(eregosGUID)) + if (!InstanceScript::SetBossState(type, state)) + return false; + + switch (type) + { + case DATA_DRAKOS: + if (state == DONE) { - eregos->SetPhaseMask(1, true); - GreaterWhelps(); + DoUpdateWorldState(WORLD_STATE_CENTRIFUGE_CONSTRUCT_SHOW, 1); + DoUpdateWorldState(WORLD_STATE_CENTRIFUGE_CONSTRUCT_AMOUNT, CentrifugueConstructCounter); + FreeDragons(); + if (Creature* varos = instance->GetCreature(VarosGUID)) + varos->SetPhaseMask(1, true); } - } - break; - case DATA_EREGOS_EVENT: - if (state == DONE) - DoRespawnGameObject(eregosCacheGUID, 7*DAY); - break; - } - - return true; - } + break; + case DATA_VAROS: + if (state == DONE) + DoUpdateWorldState(WORLD_STATE_CENTRIFUGE_CONSTRUCT_SHOW, 0); + if (Creature* urom = instance->GetCreature(UromGUID)) + urom->SetPhaseMask(1, true); + break; + case DATA_UROM: + if (state == DONE) + { + if (Creature* eregos = instance->GetCreature(EregosGUID)) + { + eregos->SetPhaseMask(1, true); + GreaterWhelps(); + } + } + break; + case DATA_EREGOS: + if (state == DONE) + { + if (GameObject* cache = instance->GetGameObject(EregosCacheGUID)) + { + cache->SetRespawnTime(cache->GetRespawnDelay()); + cache->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); + } + } + break; + } - void SetData(uint32 type, uint32 data) OVERRIDE - { - switch (type) - { - case DATA_UROM_PLATAFORM: - platformUrom = data; - break; + return true; } - } - uint32 GetData(uint32 type) const OVERRIDE - { - switch (type) + uint64 GetData64(uint32 type) const OVERRIDE { - case DATA_UROM_PLATAFORM: return platformUrom; - // used by condition system - case DATA_UROM_EVENT: return GetBossState(DATA_UROM_EVENT); - } + switch (type) + { + case DATA_DRAKOS: + return DrakosGUID; + case DATA_VAROS: + return VarosGUID; + case DATA_UROM: + return UromGUID; + case DATA_EREGOS: + return EregosGUID; + default: + break; + } - return 0; - } + return 0; + } - uint64 GetData64(uint32 identifier) const OVERRIDE - { - switch (identifier) + void FreeDragons() { - case DATA_DRAKOS: return drakosGUID; - case DATA_VAROS: return varosGUID; - case DATA_UROM: return uromGUID; - case DATA_EREGOS: return eregosGUID; - } + if (Creature* belgaristrasz = instance->GetCreature(BelgaristraszGUID)) + { + belgaristrasz->SetWalk(true); + belgaristrasz->GetMotionMaster()->MovePoint(POINT_MOVE_OUT, BelgaristraszMove); + } - return 0; - } + if (Creature* eternos = instance->GetCreature(EternosGUID)) + { + eternos->SetWalk(true); + eternos->GetMotionMaster()->MovePoint(POINT_MOVE_OUT, EternosMove); + } - void OpenCageDoors() - { - if (gameObjectList.empty()) - return; + if (Creature* verdisa = instance->GetCreature(VerdisaGUID)) + { + verdisa->SetWalk(true); + verdisa->GetMotionMaster()->MovePoint(POINT_MOVE_OUT, VerdisaMove); + } + } - for (std::list<uint64>::const_iterator itr = gameObjectList.begin(); itr != gameObjectList.end(); ++itr) + void GreaterWhelps() { - if (GameObject* go = instance->GetGameObject(*itr)) - go->SetGoState(GO_STATE_ACTIVE); + for (std::list<uint64>::const_iterator itr = GreaterWhelpList.begin(); itr != GreaterWhelpList.end(); ++itr) + if (Creature* gwhelp = instance->GetCreature(*itr)) + gwhelp->SetPhaseMask(1, true); } - } - - void FreeDragons() - { - if (Creature* belgaristrasz = instance->GetCreature(belgaristraszGUID)) - belgaristrasz->SetWalk(true), - belgaristrasz->GetMotionMaster()->MovePoint(0, 941.453f, 1044.1f, 359.967f); - if (Creature* eternos = instance->GetCreature(eternosGUID)) - eternos->SetWalk(true), - eternos->GetMotionMaster()->MovePoint(0, 943.202f, 1059.35f, 359.967f); - if (Creature* verdisa = instance->GetCreature(verdisaGUID)) - verdisa->SetWalk(true), - verdisa->GetMotionMaster()->MovePoint(0, 949.188f, 1032.91f, 359.967f); - } - void GreaterWhelps() - { - if (gwhelpList.empty()) - return; - - for (std::list<uint64>::const_iterator itr = gwhelpList.begin(); itr != gwhelpList.end(); ++itr) - if (Creature* gwhelp = instance->GetCreature(*itr)) - gwhelp->SetPhaseMask(1, true); - } - - std::string GetSaveData() OVERRIDE - { - OUT_SAVE_INST_DATA; - - std::ostringstream saveStream; - saveStream << "T O " << GetBossSaveData(); + std::string GetSaveData() OVERRIDE + { + OUT_SAVE_INST_DATA; - str_data = saveStream.str(); + std::ostringstream saveStream; + saveStream << "T O " << GetBossSaveData(); - OUT_SAVE_INST_DATA_COMPLETE; - return str_data; - } + OUT_SAVE_INST_DATA_COMPLETE; + return saveStream.str(); + } - void Load(const char* in) OVERRIDE - { - if (!in) + void Load(char const* str) OVERRIDE { - OUT_LOAD_INST_DATA_FAIL; - return; - } + if (!str) + { + OUT_LOAD_INST_DATA_FAIL; + return; + } - OUT_LOAD_INST_DATA(in); + OUT_LOAD_INST_DATA(str); - char dataHead1, dataHead2; + char dataHead1, dataHead2; - std::istringstream loadStream(in); - loadStream >> dataHead1 >> dataHead2; + std::istringstream loadStream(str); + loadStream >> dataHead1 >> dataHead2; - if (dataHead1 == 'T' && dataHead2 == 'O') - { - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + if (dataHead1 == 'T' && dataHead2 == 'O') { - uint32 tmpState; - loadStream >> tmpState; - if (tmpState == IN_PROGRESS || tmpState > SPECIAL) - tmpState = NOT_STARTED; - SetBossState(i, EncounterState(tmpState)); + for (uint32 i = 0; i < EncounterCount; ++i) + { + uint32 tmpState; + loadStream >> tmpState; + if (tmpState == IN_PROGRESS || tmpState > SPECIAL) + tmpState = NOT_STARTED; + SetBossState(i, EncounterState(tmpState)); + } } - } else OUT_LOAD_INST_DATA_FAIL; + else + OUT_LOAD_INST_DATA_FAIL; - OUT_LOAD_INST_DATA_COMPLETE; - } - private: - uint64 drakosGUID; - uint64 varosGUID; - uint64 uromGUID; - uint64 eregosGUID; + OUT_LOAD_INST_DATA_COMPLETE; + } - uint64 belgaristraszGUID; - uint64 eternosGUID; - uint64 verdisaGUID; + protected: + uint64 DrakosGUID; + uint64 VarosGUID; + uint64 UromGUID; + uint64 EregosGUID; - uint8 platformUrom; - uint8 centrifugueConstructCounter; + uint64 BelgaristraszGUID; + uint64 EternosGUID; + uint64 VerdisaGUID; - uint64 eregosCacheGUID; + uint8 CentrifugueConstructCounter; - std::string str_data; + uint64 EregosCacheGUID; - std::list<uint64> gameObjectList; - std::list<uint64> gwhelpList; - }; + std::list<uint64> GreaterWhelpList; + }; + + InstanceScript* GetInstanceScript(InstanceMap* map) const OVERRIDE + { + return new instance_oculus_InstanceMapScript(map); + } }; void AddSC_instance_oculus() diff --git a/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp b/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp index fd15cd19b37..1230868c020 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp @@ -20,77 +20,73 @@ #include "ScriptedGossip.h" #include "SpellScript.h" #include "SpellAuraEffects.h" -#include "Vehicle.h" #include "CombatAI.h" -#include "oculus.h" #include "Player.h" - -#define GOSSIP_ITEM_DRAKES "So where do we go from here?" -#define GOSSIP_ITEM_BELGARISTRASZ1 "I want to fly on the wings of the Red Flight" -#define GOSSIP_ITEM_BELGARISTRASZ2 "What abilities do Ruby Drakes have?" -#define GOSSIP_ITEM_VERDISA1 "I want to fly on the wings of the Green Flight" -#define GOSSIP_ITEM_VERDISA2 "What abilities do Emerald Drakes have?" -#define GOSSIP_ITEM_ETERNOS1 "I want to fly on the wings of the Bronze Flight" -#define GOSSIP_ITEM_ETERNOS2 "What abilities do Amber Drakes have?" - -#define HAS_ESSENCE(a) ((a)->HasItemCount(ITEM_EMERALD_ESSENCE) || (a)->HasItemCount(ITEM_AMBER_ESSENCE) || (a)->HasItemCount(ITEM_RUBY_ESSENCE)) +#include "Vehicle.h" +#include "oculus.h" enum GossipNPCs { - GOSSIP_TEXTID_DRAKES = 13267, - GOSSIP_TEXTID_BELGARISTRASZ1 = 12916, - GOSSIP_TEXTID_BELGARISTRASZ2 = 13466, - GOSSIP_TEXTID_BELGARISTRASZ3 = 13254, - GOSSIP_TEXTID_VERDISA1 = 1, - GOSSIP_TEXTID_VERDISA2 = 1, - GOSSIP_TEXTID_VERDISA3 = 1, - GOSSIP_TEXTID_ETERNOS1 = 1, - GOSSIP_TEXTID_ETERNOS2 = 1, - GOSSIP_TEXTID_ETERNOS3 = 13256, - - ITEM_EMERALD_ESSENCE = 37815, - ITEM_AMBER_ESSENCE = 37859, - ITEM_RUBY_ESSENCE = 37860, - - SPELL_SHOCK_CHARGE = 49836 + GOSSIP_MENU_VERDISA = 9573, + GOSSIP_MENU_ETERNOS = 9574, + GOSSIP_MENU_BELGARISTRASZ = 9575, + + ITEM_EMERALD_ESSENCE = 37815, + ITEM_AMBER_ESSENCE = 37859, + ITEM_RUBY_ESSENCE = 37860 }; enum Drakes { -/*Ruby Drake, -(npc 27756) (item 37860) -(summoned by spell Ruby Essence = 37860 ---> Call Amber Drake == 49462 ---> Summon 27756) -*/ - SPELL_RIDE_RUBY_DRAKE_QUE = 49463, //Apply Aura: Periodic Trigger, Interval: 3 seconds ---> 49464 - SPELL_RUBY_DRAKE_SADDLE = 49464, //Allows you to ride on the back of an Amber Drake. ---> Dummy - SPELL_RUBY_SEARING_WRATH = 50232, //(60 yds) - Instant - Breathes a stream of fire at an enemy dragon, dealing 6800 to 9200 Fire damage and then jumping to additional dragons within 30 yards. Each jump increases the damage by 50%. Affects up to 5 total targets - SPELL_RUBY_EVASIVE_AURA = 50248, //Instant - Allows the Ruby Drake to generate Evasive Charges when hit by hostile attacks and spells. - SPELL_RUBY_EVASIVE_MANEUVERS = 50240, //Instant - 5 sec. cooldown - Allows your drake to dodge all incoming attacks and spells. Requires Evasive Charges to use. Each attack or spell dodged while this ability is active burns one Evasive Charge. Lasts 30 sec. or until all charges are exhausted. - //you do not have acces to until you kill Mage-Lord Urom - SPELL_RUBY_MARTYR = 50253, //Instant - 10 sec. cooldown - Redirect all harmful spells cast at friendly drakes to yourself for 10 sec. - -/*Amber Drake, -(npc 27755) (item 37859) -(summoned by spell Amber Essence = 37859 ---> Call Amber Drake == 49461 ---> Summon 27755) -*/ - - SPELL_RIDE_AMBER_DRAKE_QUE = 49459, //Apply Aura: Periodic Trigger, Interval: 3 seconds ---> 49460 - SPELL_AMBER_DRAKE_SADDLE = 49460, //Allows you to ride on the back of an Amber Drake. ---> Dummy - SPELL_AMBER_SHOCK_LANCE = 49840, //(60 yds) - Instant - Deals 4822 to 5602 Arcane damage and detonates all Shock Charges on an enemy dragon. Damage is increased by 6525 for each detonated. - // SPELL_AMBER_STOP_TIME //Instant - 1 min cooldown - Halts the passage of time, freezing all enemy dragons in place for 10 sec. This attack applies 5 Shock Charges to each affected target. - //you do not have access to until you kill the Mage-Lord Urom. - SPELL_AMBER_TEMPORAL_RIFT = 49592, //(60 yds) - Channeled - Channels a temporal rift on an enemy dragon for 10 sec. While trapped in the rift, all damage done to the target is increased by 100%. In addition, for every 15, 000 damage done to a target affected by Temporal Rift, 1 Shock Charge is generated. - -/*Emerald Drake, -(npc 27692) (item 37815), - (summoned by spell Emerald Essence = 37815 ---> Call Emerald Drake == 49345 ---> Summon 27692) -*/ - SPELL_RIDE_EMERALD_DRAKE_QUE = 49427, //Apply Aura: Periodic Trigger, Interval: 3 seconds ---> 49346 - SPELL_EMERALD_DRAKE_SADDLE = 49346, //Allows you to ride on the back of an Amber Drake. ---> Dummy - SPELL_EMERALD_LEECHING_POISON = 50328, //(60 yds) - Instant - Poisons the enemy dragon, leeching 1300 to the caster every 2 sec. for 12 sec. Stacks up to 3 times. - SPELL_EMERALD_TOUCH_THE_NIGHTMARE = 50341, //(60 yds) - Instant - Consumes 30% of the caster's max health to inflict 25, 000 nature damage to an enemy dragon and reduce the damage it deals by 25% for 30 sec. +/* + * Ruby Drake (27756) + * (summoned by spell Ruby Essence (37860) --> Call Amber Drake (49462) --> Summon 27756) + */ + SPELL_RIDE_RUBY_DRAKE_QUE = 49463, // Apply Aura: Periodic Trigger, Interval: 3 seconds --> 49464 + SPELL_RUBY_DRAKE_SADDLE = 49464, // Allows you to ride on the back of an Amber Drake. --> Dummy + SPELL_RUBY_SEARING_WRATH = 50232, // (60 yds) - Instant - Breathes a stream of fire at an enemy dragon, dealing 6800 to 9200 Fire damage and then jumping to additional dragons within 30 yards. Each jump increases the damage by 50%. Affects up to 5 total targets + SPELL_RUBY_EVASIVE_AURA = 50248, // Instant - Allows the Ruby Drake to generate Evasive Charges when hit by hostile attacks and spells. + SPELL_RUBY_EVASIVE_CHARGES = 50241, + SPELL_RUBY_EVASIVE_MANEUVERS = 50240, // Instant - 5 sec. cooldown - Allows your drake to dodge all incoming attacks and spells. Requires Evasive Charges to use. Each attack or spell dodged while this ability is active burns one Evasive Charge. Lasts 30 sec. or until all charges are exhausted. + // you do not have acces to until you kill Mage-Lord Urom + SPELL_RUBY_MARTYR = 50253, // Instant - 10 sec. cooldown - Redirect all harmful spells cast at friendly drakes to yourself for 10 sec. + +/* + * Amber Drake (27755) + * (summoned by spell Amber Essence (37859) --> Call Amber Drake (49461) --> Summon 27755) + */ + SPELL_RIDE_AMBER_DRAKE_QUE = 49459, // Apply Aura: Periodic Trigger, Interval: 3 seconds --> 49460 + SPELL_AMBER_DRAKE_SADDLE = 49460, // Allows you to ride on the back of an Amber Drake. --> Dummy + SPELL_AMBER_SHOCK_CHARGE = 49836, + SPELL_AMBER_SHOCK_LANCE = 49840, // (60 yds) - Instant - Deals 4822 to 5602 Arcane damage and detonates all Shock Charges on an enemy dragon. Damage is increased by 6525 for each detonated. + SPELL_AMBER_STOP_TIME = 49838, // Instant - 1 min cooldown - Halts the passage of time, freezing all enemy dragons in place for 10 sec. This attack applies 5 Shock Charges to each affected target. + // you do not have access to until you kill the Mage-Lord Urom. + SPELL_AMBER_TEMPORAL_RIFT = 49592, // (60 yds) - Channeled - Channels a temporal rift on an enemy dragon for 10 sec. While trapped in the rift, all damage done to the target is increased by 100%. In addition, for every 15, 000 damage done to a target affected by Temporal Rift, 1 Shock Charge is generated. + +/* + * Emerald Drake (27692) + * (summoned by spell Emerald Essence (37815) --> Call Emerald Drake (49345) --> Summon 27692) + */ + SPELL_RIDE_EMERALD_DRAKE_QUE = 49427, // Apply Aura: Periodic Trigger, Interval: 3 seconds --> 49346 + SPELL_EMERALD_DRAKE_SADDLE = 49346, // Allows you to ride on the back of an Amber Drake. --> Dummy + SPELL_EMERALD_LEECHING_POISON = 50328, // (60 yds) - Instant - Poisons the enemy dragon, leeching 1300 to the caster every 2 sec. for 12 sec. Stacks up to 3 times. + SPELL_EMERALD_TOUCH_THE_NIGHTMARE = 50341, // (60 yds) - Instant - Consumes 30% of the caster's max health to inflict 25, 000 nature damage to an enemy dragon and reduce the damage it deals by 25% for 30 sec. // you do not have access to until you kill the Mage-Lord Urom - SPELL_EMERALD_DREAM_FUNNEL = 50344, //(60 yds) - Channeled - Transfers 5% of the caster's max health to a friendly drake every second for 10 seconds as long as the caster channels. + SPELL_EMERALD_DREAM_FUNNEL = 50344, // (60 yds) - Channeled - Transfers 5% of the caster's max health to a friendly drake every second for 10 seconds as long as the caster channels. + + // Misc + POINT_LAND = 2, + POINT_TAKE_OFF = 3 +}; + +enum DrakeEvents +{ + EVENT_WELCOME = 1, + EVENT_ABILITIES, + EVENT_SPECIAL_ATTACK, + EVENT_LOW_HEALTH, + EVENT_RESET_LOW_HEALTH, + EVENT_TAKE_OFF }; enum Says @@ -107,420 +103,500 @@ enum Says class npc_verdisa_beglaristrasz_eternos : public CreatureScript { -public: - npc_verdisa_beglaristrasz_eternos() : CreatureScript("npc_verdisa_beglaristrasz_eternos") { } + public: + npc_verdisa_beglaristrasz_eternos() : CreatureScript("npc_verdisa_beglaristrasz_eternos") { } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) OVERRIDE - { - player->PlayerTalkClass->ClearMenus(); - switch (creature->GetEntry()) + struct npc_verdisa_beglaristrasz_eternosAI : public ScriptedAI { - case NPC_VERDISA: //Verdisa + npc_verdisa_beglaristrasz_eternosAI(Creature* creature) : ScriptedAI(creature) { } + + void StoreEssence(Player* player, uint32 itemId) { - switch (action) - { - case GOSSIP_ACTION_INFO_DEF + 1: - if (!HAS_ESSENCE(player)) - { - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_VERDISA1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_VERDISA2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); - player->SEND_GOSSIP_MENU(GOSSIP_TEXTID_VERDISA1, creature->GetGUID()); - } - else - { - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_VERDISA2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); - player->SEND_GOSSIP_MENU(GOSSIP_TEXTID_VERDISA2, creature->GetGUID()); - } - break; - case GOSSIP_ACTION_INFO_DEF + 2: - { - ItemPosCountVec dest; - uint8 msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, ITEM_EMERALD_ESSENCE, 1); - if (msg == EQUIP_ERR_OK) - player->StoreNewItem(dest, ITEM_EMERALD_ESSENCE, true); - player->CLOSE_GOSSIP_MENU(); - break; - } - case GOSSIP_ACTION_INFO_DEF + 3: - player->SEND_GOSSIP_MENU(GOSSIP_TEXTID_VERDISA3, creature->GetGUID()); - break; - } - break; + /// @todo: should be handled by spell, but not found in dbc (49450 and other?) + uint32 count = 1; + ItemPosCountVec dest; + uint8 msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemId, count); + if (msg == EQUIP_ERR_OK) + if (Item* item = player->StoreNewItem(dest, itemId, true)) + player->SendNewItem(item, count, true, true); } - case NPC_BELGARISTRASZ: //Belgaristrasz + + void RemoveEssence(Player* player, uint32 itemId) { - switch (action) - { - case GOSSIP_ACTION_INFO_DEF + 1: - if (!HAS_ESSENCE(player)) - { - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_BELGARISTRASZ1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_BELGARISTRASZ2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); - player->SEND_GOSSIP_MENU(GOSSIP_TEXTID_BELGARISTRASZ1, creature->GetGUID()); - } - else - { - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_BELGARISTRASZ2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); - player->SEND_GOSSIP_MENU(GOSSIP_TEXTID_BELGARISTRASZ2, creature->GetGUID()); - } - break; - case GOSSIP_ACTION_INFO_DEF + 2: - { - ItemPosCountVec dest; - uint8 msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, ITEM_RUBY_ESSENCE, 1); - if (msg == EQUIP_ERR_OK) - player->StoreNewItem(dest, ITEM_RUBY_ESSENCE, true); - player->CLOSE_GOSSIP_MENU(); - break; - } - case GOSSIP_ACTION_INFO_DEF + 3: - player->SEND_GOSSIP_MENU(GOSSIP_TEXTID_BELGARISTRASZ3, creature->GetGUID()); - break; - } - break; + player->DestroyItemCount(itemId, 1, true, false); } - case NPC_ETERNOS: //Eternos + + void sGossipSelect(Player* player, uint32 menuId, uint32 gossipListId) OVERRIDE { - switch (action) + switch (menuId) { - case GOSSIP_ACTION_INFO_DEF + 1: - if (!HAS_ESSENCE(player)) + case GOSSIP_MENU_VERDISA: + if (gossipListId >= 1 && gossipListId <= 3) { - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ETERNOS1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ETERNOS2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); - player->SEND_GOSSIP_MENU(GOSSIP_TEXTID_ETERNOS1, creature->GetGUID()); + if (gossipListId == 2) + RemoveEssence(player, ITEM_AMBER_ESSENCE); + else if (gossipListId == 3) + RemoveEssence(player, ITEM_RUBY_ESSENCE); + + StoreEssence(player, ITEM_EMERALD_ESSENCE); + break; } - else + return; + case GOSSIP_MENU_ETERNOS: + if (gossipListId >= 1 && gossipListId <= 3) { - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ETERNOS2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); - player->SEND_GOSSIP_MENU(GOSSIP_TEXTID_ETERNOS2, creature->GetGUID()); + if (gossipListId == 2) + RemoveEssence(player, ITEM_EMERALD_ESSENCE); + else if (gossipListId == 3) + RemoveEssence(player, ITEM_RUBY_ESSENCE); + + StoreEssence(player, ITEM_AMBER_ESSENCE); + break; } - break; - case GOSSIP_ACTION_INFO_DEF + 2: - { - ItemPosCountVec dest; - uint8 msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, ITEM_AMBER_ESSENCE, 1); - if (msg == EQUIP_ERR_OK) - player->StoreNewItem(dest, ITEM_AMBER_ESSENCE, true); - player->CLOSE_GOSSIP_MENU(); - break; - } - case GOSSIP_ACTION_INFO_DEF + 3: - player->SEND_GOSSIP_MENU(GOSSIP_TEXTID_ETERNOS3, creature->GetGUID()); - break; + return; + case GOSSIP_MENU_BELGARISTRASZ: + if (gossipListId <= 2) + { + if (gossipListId == 1) + RemoveEssence(player, ITEM_AMBER_ESSENCE); + else if (gossipListId == 2) + RemoveEssence(player, ITEM_EMERALD_ESSENCE); + + StoreEssence(player, ITEM_RUBY_ESSENCE); + break; + } + return; + default: + return; } - break; + player->PlayerTalkClass->SendCloseGossip(); } - } - - return true; - } - bool OnGossipHello(Player* player, Creature* creature) OVERRIDE - { - if (creature->IsQuestGiver()) - player->PrepareQuestMenu(creature->GetGUID()); - - if (InstanceScript* instance = creature->GetInstanceScript()) - { - if (instance->GetBossState(DATA_DRAKOS_EVENT) == DONE) + void MovementInform(uint32 /*type*/, uint32 id) OVERRIDE { - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_DRAKES, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - player->SEND_GOSSIP_MENU(GOSSIP_TEXTID_DRAKES, creature->GetGUID()); - } - } + if (id != POINT_MOVE_OUT) + return; - return true; - } + // When Belgaristraz finish his moving say grateful text + if (me->GetEntry() == NPC_BELGARISTRASZ) + Talk(SAY_BELGARISTRASZ); - struct npc_verdisa_beglaristrasz_eternosAI : public ScriptedAI - { - npc_verdisa_beglaristrasz_eternosAI(Creature* creature) : ScriptedAI(creature) { } + // The gossip flag should activate when Drakos die and not from DB + me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + } + }; - void MovementInform(uint32 /*type*/, uint32 id) OVERRIDE + CreatureAI* GetAI(Creature* creature) const OVERRIDE { - if (id) - return; - - // When Belgaristraz finish his moving say grateful text - if (me->GetEntry() == NPC_BELGARISTRASZ) - Talk(SAY_BELGARISTRASZ); - - // The gossip flag should activate when Drakos die and not from DB - me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + return GetOculusAI<npc_verdisa_beglaristrasz_eternosAI>(creature); } - }; - - CreatureAI* GetAI(Creature* creature) const OVERRIDE - { - return new npc_verdisa_beglaristrasz_eternosAI(creature); - } }; class npc_image_belgaristrasz : public CreatureScript { -public: - npc_image_belgaristrasz() : CreatureScript("npc_image_belgaristrasz") { } - - struct npc_image_belgaristraszAI : public ScriptedAI - { - npc_image_belgaristraszAI(Creature* creature) : ScriptedAI(creature) { } + public: + npc_image_belgaristrasz() : CreatureScript("npc_image_belgaristrasz") { } - void IsSummonedBy(Unit* summoner) OVERRIDE + struct npc_image_belgaristraszAI : public ScriptedAI { - if (summoner->GetEntry() == NPC_VAROS) - { - Talk(SAY_VAROS); - me->DespawnOrUnsummon(60000); - } - if (summoner->GetEntry() == NPC_UROM) + npc_image_belgaristraszAI(Creature* creature) : ScriptedAI(creature) { } + + void IsSummonedBy(Unit* summoner) OVERRIDE { - Talk(SAY_UROM); - me->DespawnOrUnsummon(60000); + if (summoner->GetEntry() == NPC_VAROS) + { + Talk(SAY_VAROS); + me->DespawnOrUnsummon(60000); + } + + if (summoner->GetEntry() == NPC_UROM) + { + Talk(SAY_UROM); + me->DespawnOrUnsummon(60000); + } } - } - }; + }; - CreatureAI* GetAI(Creature* creature) const OVERRIDE - { - return new npc_image_belgaristraszAI(creature); - } + CreatureAI* GetAI(Creature* creature) const OVERRIDE + { + return GetOculusAI<npc_image_belgaristraszAI>(creature); + } }; class npc_ruby_emerald_amber_drake : public CreatureScript { -public: - npc_ruby_emerald_amber_drake() : CreatureScript("npc_ruby_emerald_amber_drake") { } + public: + npc_ruby_emerald_amber_drake() : CreatureScript("npc_ruby_emerald_amber_drake") { } - struct npc_ruby_emerald_amber_drakeAI : public VehicleAI - { - npc_ruby_emerald_amber_drakeAI(Creature* creature) : VehicleAI(creature) + struct npc_ruby_emerald_amber_drakeAI : public VehicleAI { - instance = creature->GetInstanceScript(); - } - - InstanceScript* instance; + npc_ruby_emerald_amber_drakeAI(Creature* creature) : VehicleAI(creature) + { + _instance = creature->GetInstanceScript(); + } - uint64 summonerGUID; - uint32 WelcomeTimer; - uint32 WelcomeSequelTimer; - uint32 SpecialTimer; - uint32 WarningTimer; - uint32 TakeOffTimer; + void Reset() OVERRIDE + { + _events.Reset(); + _healthWarning = true; + } - bool WelcomeOff; - bool WelcomeSequelOff; - bool SpecialOff; - bool HealthWarningOff; - bool DisableTakeOff; + void IsSummonedBy(Unit* summoner) OVERRIDE + { + if (_instance->GetBossState(DATA_EREGOS) == IN_PROGRESS) + if (Creature* eregos = me->FindNearestCreature(NPC_EREGOS, 450.0f, true)) + eregos->DespawnOrUnsummon(); // On retail this kills abusive call of drake during engaged Eregos - void Reset() OVERRIDE - { - summonerGUID = 0; - WelcomeTimer = 4500; - WelcomeSequelTimer = 4500; - SpecialTimer = 10000; - WarningTimer = 25000; - TakeOffTimer = 3500; - - WelcomeOff = false; - WelcomeSequelOff = false; - SpecialOff = false; - HealthWarningOff = false; - DisableTakeOff = false; - } + me->SetFacingToObject(summoner); - void IsSummonedBy(Unit* summoner) OVERRIDE - { - if (instance->GetBossState(DATA_EREGOS_EVENT) == IN_PROGRESS) - if (Creature* eregos = me->FindNearestCreature(NPC_EREGOS, 450.0f, true)) + switch (me->GetEntry()) { - eregos->DespawnOrUnsummon(); // On retail this kills abusive call of drake during engaged Eregos + case NPC_RUBY_DRAKE_VEHICLE: + me->CastSpell(summoner, SPELL_RIDE_RUBY_DRAKE_QUE); + break; + case NPC_EMERALD_DRAKE_VEHICLE: + me->CastSpell(summoner, SPELL_RIDE_EMERALD_DRAKE_QUE); + break; + case NPC_AMBER_DRAKE_VEHICLE: + me->CastSpell(summoner, SPELL_RIDE_AMBER_DRAKE_QUE); + break; + default: + return; } - summonerGUID = summoner->GetGUID(); - me->SetFacingToObject(summoner); - // TO DO: Drake Ques should be casted from vehicle to player, however the way core handle triggered spells from auras break it no matter the conditions. So this change the caster and give the same result until someone fix triggered spells from auras that involve implicit targets or make exception for this case. - if (me->GetEntry() == NPC_RUBY_DRAKE_VEHICLE) - summoner->CastSpell(summoner, SPELL_RIDE_RUBY_DRAKE_QUE); - if (me->GetEntry() == NPC_EMERALD_DRAKE_VEHICLE) - summoner->CastSpell(summoner, SPELL_RIDE_EMERALD_DRAKE_QUE); - if (me->GetEntry() == NPC_AMBER_DRAKE_VEHICLE) - summoner->CastSpell(summoner, SPELL_RIDE_AMBER_DRAKE_QUE); - Position pos; - summoner->GetPosition(&pos); - me->GetMotionMaster()->MovePoint(0, pos); - } - void MovementInform(uint32 type, uint32 id) OVERRIDE - { - if (type == POINT_MOTION_TYPE && id == 0) - me->SetDisableGravity(false); // Needed this for proper animation after spawn, the summon in air fall to ground bug leave no other option for now, if this isn't used the drake will only walk on move. - } + Position pos; + summoner->GetPosition(&pos); + me->GetMotionMaster()->MovePoint(POINT_LAND, pos); + } - void UpdateAI(uint32 diff) OVERRIDE - { - if (!(instance->GetBossState(DATA_VAROS_EVENT) == DONE)) + void MovementInform(uint32 type, uint32 id) OVERRIDE { - if (me->HasAuraType(SPELL_AURA_CONTROL_VEHICLE)) - { - if (!(WelcomeOff)) - { - if (WelcomeTimer <= diff) - { - Talk(WHISPER_DRAKES_WELCOME, me->GetCreatorGUID()); - WelcomeOff = true; - WelcomeSequelOff = true; - } - else WelcomeTimer -= diff; - } - } + if (type == POINT_MOTION_TYPE && id == POINT_LAND) + me->SetDisableGravity(false); // Needed this for proper animation after spawn, the summon in air fall to ground bug leave no other option for now, if this isn't used the drake will only walk on move. } - if (me->HasAuraType(SPELL_AURA_CONTROL_VEHICLE)) + + void PassengerBoarded(Unit* passenger, int8 /*seatId*/, bool apply) OVERRIDE { - if (WelcomeSequelOff) + if (passenger->GetTypeId() != TYPEID_PLAYER) + return; + + if (apply) { - if (WelcomeSequelTimer <= diff) - { - Talk(WHISPER_DRAKES_ABILITIES, me->GetCreatorGUID()); - WelcomeSequelOff = false; - } - else WelcomeSequelTimer -= diff; - } + if (_instance->GetBossState(DATA_VAROS) != DONE) + _events.ScheduleEvent(EVENT_WELCOME, 10 * IN_MILLISECONDS); - if (instance->GetBossState(DATA_UROM_EVENT) == DONE) + else if (_instance->GetBossState(DATA_UROM) == DONE) + _events.ScheduleEvent(EVENT_SPECIAL_ATTACK, 10 * IN_MILLISECONDS); + } + else { - if (!(SpecialOff)) - { - if (SpecialTimer <= diff) - { - Talk(WHISPER_DRAKES_SPECIAL, me->GetCreatorGUID()); - SpecialOff = true; - } - else SpecialTimer -= diff; - } + _events.Reset(); + _events.ScheduleEvent(EVENT_TAKE_OFF, 2 * IN_MILLISECONDS); } + } - if (!(HealthWarningOff)) + void UpdateAI(uint32 diff) OVERRIDE + { + if (_healthWarning) { if (me->GetHealthPct() <= 40.0f) - { - Talk(WHISPER_DRAKES_LOWHEALTH, me->GetCreatorGUID()); - HealthWarningOff = true; - } + _events.ScheduleEvent(EVENT_LOW_HEALTH, 0); } - if (HealthWarningOff) + _events.Update(diff); + + while (uint32 eventId = _events.ExecuteEvent()) { - if (WarningTimer <= diff) + switch (eventId) { - HealthWarningOff = false; - WarningTimer = 25000; + case EVENT_WELCOME: + Talk(WHISPER_DRAKES_WELCOME, me->GetCreatorGUID()); + _events.ScheduleEvent(EVENT_ABILITIES, 5 * IN_MILLISECONDS); + break; + case EVENT_ABILITIES: + Talk(WHISPER_DRAKES_ABILITIES, me->GetCreatorGUID()); + break; + case EVENT_SPECIAL_ATTACK: + Talk(WHISPER_DRAKES_SPECIAL, me->GetCreatorGUID()); + break; + case EVENT_LOW_HEALTH: + Talk(WHISPER_DRAKES_LOWHEALTH, me->GetCreatorGUID()); + _healthWarning = false; + _events.ScheduleEvent(EVENT_RESET_LOW_HEALTH, 25000); + break; + case EVENT_RESET_LOW_HEALTH: + _healthWarning = true; + break; + case EVENT_TAKE_OFF: + { + me->DespawnOrUnsummon(2050); + me->SetOrientation(2.5f); + me->SetSpeed(MOVE_FLIGHT, 1.0f, true); + Talk(SAY_DRAKES_TAKEOFF); + Position pos; + me->GetPosition(&pos); + Position offset = { 10.0f, 10.0f, 12.0f, 0.0f }; + pos.RelocateOffset(offset); + me->SetDisableGravity(true); + me->GetMotionMaster()->MovePoint(POINT_TAKE_OFF, pos); + break; + } + default: + break; } - else WarningTimer -= diff; } + }; + + private: + InstanceScript* _instance; + EventMap _events; + bool _healthWarning; + }; + + CreatureAI* GetAI(Creature* creature) const OVERRIDE + { + return GetOculusAI<npc_ruby_emerald_amber_drakeAI>(creature); + } +}; + +// 49345 - Call Emerald Drake +// 49461 - Call Amber Drake +// 49462 - Call Ruby Drake +class spell_oculus_call_ruby_emerald_amber_drake : public SpellScriptLoader +{ + public: + spell_oculus_call_ruby_emerald_amber_drake() : SpellScriptLoader("spell_oculus_call_ruby_emerald_amber_drake") { } + + class spell_oculus_call_ruby_emerald_amber_drake_SpellScript : public SpellScript + { + PrepareSpellScript(spell_oculus_call_ruby_emerald_amber_drake_SpellScript); + + void ChangeSummonPos(SpellEffIndex /*effIndex*/) + { + // Adjust effect summon position + WorldLocation summonPos = *GetExplTargetDest(); + Position offset = { 0.0f, 0.0f, 12.0f, 0.0f }; + summonPos.RelocateOffset(offset); + SetExplTargetDest(summonPos); + GetHitDest()->RelocateOffset(offset); } - if (!(me->HasAuraType(SPELL_AURA_CONTROL_VEHICLE))) + void ModDestHeight(SpellEffIndex /*effIndex*/) { - if (!(DisableTakeOff)) - { - if (TakeOffTimer <= diff) - { - me->DespawnOrUnsummon(2050); - me->SetOrientation(2.5f); - me->SetSpeed(MOVE_FLIGHT, 1.0f, true); - Talk(SAY_DRAKES_TAKEOFF); - Position pos; - me->GetPosition(&pos); - pos.m_positionX += 10.0f; - pos.m_positionY += 10.0f; - pos.m_positionZ += 12.0f; - me->GetMotionMaster()->MovePoint(1, pos); - DisableTakeOff = true; - } - else TakeOffTimer -= diff; - } + // Used to cast visual effect at proper position + Position offset = { 0.0f, 0.0f, 12.0f, 0.0f }; + const_cast<WorldLocation*>(GetExplTargetDest())->RelocateOffset(offset); + } + + void Register() OVERRIDE + { + OnEffectHit += SpellEffectFn(spell_oculus_call_ruby_emerald_amber_drake_SpellScript::ChangeSummonPos, EFFECT_0, SPELL_EFFECT_SUMMON); + OnEffectLaunch += SpellEffectFn(spell_oculus_call_ruby_emerald_amber_drake_SpellScript::ModDestHeight, EFFECT_0, SPELL_EFFECT_SUMMON); } }; - }; - CreatureAI* GetAI(Creature* creature) const OVERRIDE - { - return new npc_ruby_emerald_amber_drakeAI(creature); - } + SpellScript* GetSpellScript() const OVERRIDE + { + return new spell_oculus_call_ruby_emerald_amber_drake_SpellScript(); + } }; -class spell_gen_stop_time : public SpellScriptLoader +// 49427 - Ride Emerald Drake Que +// 49459 - Ride Amber Drake Que +// 49463 - Ride Ruby Drake Que +class spell_oculus_ride_ruby_emerald_amber_drake_que : public SpellScriptLoader { -public: - spell_gen_stop_time() : SpellScriptLoader("spell_gen_stop_time") { } + public: + spell_oculus_ride_ruby_emerald_amber_drake_que() : SpellScriptLoader("spell_oculus_ride_ruby_emerald_amber_drake_que") { } - class spell_gen_stop_time_AuraScript : public AuraScript - { - PrepareAuraScript(spell_gen_stop_time_AuraScript); + class spell_oculus_ride_ruby_emerald_amber_drake_que_AuraScript : public AuraScript + { + PrepareAuraScript(spell_oculus_ride_ruby_emerald_amber_drake_que_AuraScript); + + void HandlePeriodic(AuraEffect const* aurEff) + { + // caster of the triggered spell is wrong for an unknown reason, handle it here correctly + PreventDefaultAction(); + if (Unit* caster = GetCaster()) + GetTarget()->CastSpell(caster, GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell, true); + } - void Apply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + void Register() OVERRIDE + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_oculus_ride_ruby_emerald_amber_drake_que_AuraScript::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); + } + }; + + AuraScript* GetAuraScript() const OVERRIDE { - Unit* caster = GetCaster(); - if (!caster) - return; - Unit* target = GetTarget(); - for (uint32 i = 0; i < 5; ++i) - caster->CastSpell(target, SPELL_SHOCK_CHARGE, false); + return new spell_oculus_ride_ruby_emerald_amber_drake_que_AuraScript(); } +}; + +// 50240 - Evasive Maneuvers +class spell_oculus_evasive_maneuvers : public SpellScriptLoader +{ + public: + spell_oculus_evasive_maneuvers() : SpellScriptLoader("spell_oculus_evasive_maneuvers") { } - void Register() OVERRIDE + class spell_oculus_evasive_maneuvers_AuraScript : public AuraScript { - AfterEffectApply += AuraEffectApplyFn(spell_gen_stop_time_AuraScript::Apply, EFFECT_0, SPELL_AURA_MOD_STUN, AURA_EFFECT_HANDLE_REAL); - } - }; + PrepareAuraScript(spell_oculus_evasive_maneuvers_AuraScript); + + bool Validate(SpellInfo const* /*spellInfo*/) OVERRIDE + { + if (!sSpellMgr->GetSpellInfo(SPELL_RUBY_EVASIVE_CHARGES)) + return false; + return true; + } - AuraScript* GetAuraScript() const OVERRIDE - { - return new spell_gen_stop_time_AuraScript(); - } + void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& /*eventInfo*/) + { + PreventDefaultAction(); + GetTarget()->RemoveAuraFromStack(SPELL_RUBY_EVASIVE_CHARGES); + if (!GetTarget()->HasAura(SPELL_RUBY_EVASIVE_CHARGES)) + Remove(); + } + + void Register() OVERRIDE + { + OnEffectProc += AuraEffectProcFn(spell_oculus_evasive_maneuvers_AuraScript::HandleProc, EFFECT_2, SPELL_AURA_PROC_TRIGGER_SPELL); + } + }; + + AuraScript* GetAuraScript() const OVERRIDE + { + return new spell_oculus_evasive_maneuvers_AuraScript(); + } }; -class spell_call_ruby_emerald_amber_drake : public SpellScriptLoader +// 49840 - Shock Lance +class spell_oculus_shock_lance : public SpellScriptLoader { -public: - spell_call_ruby_emerald_amber_drake() : SpellScriptLoader("spell_call_ruby_emerald_amber_drake") { } + public: + spell_oculus_shock_lance() : SpellScriptLoader("spell_oculus_shock_lance") { } + + class spell_oculus_shock_lance_SpellScript : public SpellScript + { + PrepareSpellScript(spell_oculus_shock_lance_SpellScript); + + bool Validate(SpellInfo const* /*spellInfo*/) OVERRIDE + { + if (!sSpellMgr->GetSpellInfo(SPELL_AMBER_SHOCK_CHARGE)) + return false; + return true; + } - class spell_call_ruby_emerald_amber_drake_SpellScript : public SpellScript - { - PrepareSpellScript(spell_call_ruby_emerald_amber_drake_SpellScript); + void CalcDamage() + { + int32 damage = GetHitDamage(); + if (Unit* target = GetHitUnit()) + if (AuraEffect const* shockCharges = target->GetAuraEffect(SPELL_AMBER_SHOCK_CHARGE, EFFECT_0, GetCaster()->GetGUID())) + { + damage += shockCharges->GetAmount(); + shockCharges->GetBase()->Remove(); + } + + SetHitDamage(damage); + } + + void Register() OVERRIDE + { + OnHit += SpellHitFn(spell_oculus_shock_lance_SpellScript::CalcDamage); + } + }; - void ChangeSummonPos(SpellEffIndex /*effIndex*/) + SpellScript* GetSpellScript() const OVERRIDE { - // Adjust effect summon position - WorldLocation summonPos = *GetExplTargetDest(); - Position offset = {0.0f, 0.0f, 12.0f, 0.0f}; - summonPos.RelocateOffset(offset); - SetExplTargetDest(summonPos); - GetHitDest()->RelocateOffset(offset); + return new spell_oculus_shock_lance_SpellScript(); } +}; + +// 49838 - Stop Time +class spell_oculus_stop_time : public SpellScriptLoader +{ + public: + spell_oculus_stop_time() : SpellScriptLoader("spell_oculus_stop_time") { } - void ModDestHeight(SpellEffIndex /*effIndex*/) + class spell_oculus_stop_time_AuraScript : public AuraScript { - // Used to cast visual effect at proper position - Position offset = {0.0f, 0.0f, 12.0f, 0.0f}; - const_cast<WorldLocation*>(GetExplTargetDest())->RelocateOffset(offset); - } + PrepareAuraScript(spell_oculus_stop_time_AuraScript); + + bool Validate(SpellInfo const* /*spellInfo*/) OVERRIDE + { + if (!sSpellMgr->GetSpellInfo(SPELL_AMBER_SHOCK_CHARGE)) + return false; + return true; + } + + void Apply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + Unit* caster = GetCaster(); + if (!caster) + return; + + Unit* target = GetTarget(); + for (uint32 i = 0; i < 5; ++i) + caster->CastSpell(target, SPELL_AMBER_SHOCK_CHARGE, true); + } + + void Register() OVERRIDE + { + AfterEffectApply += AuraEffectApplyFn(spell_oculus_stop_time_AuraScript::Apply, EFFECT_0, SPELL_AURA_MOD_STUN, AURA_EFFECT_HANDLE_REAL); + } + }; - void Register() OVERRIDE + AuraScript* GetAuraScript() const OVERRIDE { - OnEffectHit += SpellEffectFn(spell_call_ruby_emerald_amber_drake_SpellScript::ChangeSummonPos, EFFECT_0, SPELL_EFFECT_SUMMON); - OnEffectLaunch += SpellEffectFn(spell_call_ruby_emerald_amber_drake_SpellScript::ModDestHeight, EFFECT_0, SPELL_EFFECT_SUMMON); + return new spell_oculus_stop_time_AuraScript(); } - }; - - SpellScript* GetSpellScript() const OVERRIDE - { - return new spell_call_ruby_emerald_amber_drake_SpellScript(); - } }; +// 49592 - Temporal Rift +class spell_oculus_temporal_rift : public SpellScriptLoader +{ + public: + spell_oculus_temporal_rift() : SpellScriptLoader("spell_oculus_temporal_rift") { } + + class spell_oculus_temporal_rift_AuraScript : public AuraScript + { + PrepareAuraScript(spell_oculus_temporal_rift_AuraScript); + + bool Validate(SpellInfo const* /*spellInfo*/) OVERRIDE + { + if (!sSpellMgr->GetSpellInfo(SPELL_AMBER_SHOCK_CHARGE)) + return false; + return true; + } + + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + { + PreventDefaultAction(); + int32 amount = aurEff->GetAmount() + eventInfo.GetDamageInfo()->GetDamage(); + + if (amount >= 15000) + { + if (Unit* caster = GetCaster()) + caster->CastSpell(GetTarget(), SPELL_AMBER_SHOCK_CHARGE, true); + amount -= 15000; + } + + const_cast<AuraEffect*>(aurEff)->SetAmount(amount); + } + + void Register() OVERRIDE + { + OnEffectProc += AuraEffectProcFn(spell_oculus_temporal_rift_AuraScript::HandleProc, EFFECT_2, SPELL_AURA_DUMMY); + } + }; + + AuraScript* GetAuraScript() const OVERRIDE + { + return new spell_oculus_temporal_rift_AuraScript(); + } +}; +// 50341 - Touch the Nightmare class spell_oculus_touch_the_nightmare : public SpellScriptLoader { public: @@ -547,7 +623,8 @@ class spell_oculus_touch_the_nightmare : public SpellScriptLoader } }; -class spell_oculus_dream_funnel: public SpellScriptLoader +// 50344 - Dream Funnel +class spell_oculus_dream_funnel : public SpellScriptLoader { public: spell_oculus_dream_funnel() : SpellScriptLoader("spell_oculus_dream_funnel") { } @@ -582,8 +659,12 @@ void AddSC_oculus() new npc_verdisa_beglaristrasz_eternos(); new npc_image_belgaristrasz(); new npc_ruby_emerald_amber_drake(); - new spell_gen_stop_time(); - new spell_call_ruby_emerald_amber_drake(); + new spell_oculus_call_ruby_emerald_amber_drake(); + new spell_oculus_ride_ruby_emerald_amber_drake_que(); + new spell_oculus_evasive_maneuvers(); + new spell_oculus_shock_lance(); + new spell_oculus_stop_time(); + new spell_oculus_temporal_rift(); new spell_oculus_touch_the_nightmare(); new spell_oculus_dream_funnel(); } diff --git a/src/server/scripts/Northrend/Nexus/Oculus/oculus.h b/src/server/scripts/Northrend/Nexus/Oculus/oculus.h index 2dd5df3bc3b..6f34cfbf6e5 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/oculus.h +++ b/src/server/scripts/Northrend/Nexus/Oculus/oculus.h @@ -15,59 +15,55 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef DEF_OCULUS_H -#define DEF_OCULUS_H +#ifndef OCULUS_H_ +#define OCULUS_H_ -enum Data -{ - DATA_DRAKOS_EVENT, - DATA_VAROS_EVENT, - DATA_UROM_EVENT, - DATA_EREGOS_EVENT, - DATA_UROM_PLATAFORM -}; +#define OculusScriptName "instance_oculus" + +uint32 const EncounterCount = 4; -enum Data64 +enum DataTypes { - DATA_DRAKOS, - DATA_VAROS, - DATA_UROM, - DATA_EREGOS + // Encounter States/Boss GUIDs + DATA_DRAKOS = 0, + DATA_VAROS = 1, + DATA_UROM = 2, + DATA_EREGOS = 3 }; -enum Bosses_NPCs +enum CreatureIds { NPC_DRAKOS = 27654, NPC_VAROS = 27447, NPC_UROM = 27655, NPC_EREGOS = 27656, - NPC_AZURE_RING_GUARDIAN = 28236, - NPC_CENTRIFUGE_CONSTRUCT = 27641, - NPC_RUBY_DRAKE_VEHICLE = 27756, - NPC_EMERALD_DRAKE_VEHICLE = 27692, - NPC_AMBER_DRAKE_VEHICLE = 27755, - NPC_VERDISA = 27657, - NPC_BELGARISTRASZ = 27658, - NPC_ETERNOS = 27659, - NPC_GREATER_WHELP = 28276 + NPC_AZURE_RING_GUARDIAN = 28236, + NPC_CENTRIFUGE_CONSTRUCT = 27641, + NPC_RUBY_DRAKE_VEHICLE = 27756, + NPC_EMERALD_DRAKE_VEHICLE = 27692, + NPC_AMBER_DRAKE_VEHICLE = 27755, + NPC_VERDISA = 27657, + NPC_BELGARISTRASZ = 27658, + NPC_ETERNOS = 27659, + NPC_GREATER_WHELP = 28276 }; -enum GameObjects +enum GameObjectIds { - GO_DRAGON_CAGE_DOOR = 193995, - GO_EREGOS_CACHE_N = 191349, - GO_EREGOS_CACHE_H = 193603 + GO_DRAGON_CAGE_DOOR = 193995, + GO_EREGOS_CACHE_N = 191349, + GO_EREGOS_CACHE_H = 193603 }; enum SpellEvents { - EVENT_CALL_DRAGON = 12229 + EVENT_CALL_DRAGON = 12229 }; enum CreatureActions { - ACTION_CALL_DRAGON_EVENT = 1 + ACTION_CALL_DRAGON_EVENT = 1 }; enum OculusWorldStates @@ -78,7 +74,19 @@ enum OculusWorldStates enum OculusSpells { - SPELL_CENTRIFUGE_SHIELD = 50053, - SPELL_DEATH_SPELL = 50415 + SPELL_CENTRIFUGE_SHIELD = 50053, + SPELL_DEATH_SPELL = 50415 }; -#endif + +enum Misc +{ + POINT_MOVE_OUT = 1 +}; + +template<class AI> +AI* GetOculusAI(Creature* creature) +{ + return GetInstanceAI<AI>(creature, OculusScriptName); +} + +#endif // OCULUS_H_ diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp index b70bda76d76..77c19422da0 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp @@ -58,19 +58,14 @@ enum Creatures NPC_STASIS_CONTROLLER = 26688 }; -struct Locations +Position const moveLocs[] = { - float x, y, z; -}; - -struct Locations moveLocs[]= -{ - {261.6f, -449.3f, 109.5f}, - {263.3f, -454.0f, 109.5f}, - {291.5f, -450.4f, 109.5f}, - {291.5f, -454.0f, 109.5f}, - {310.0f, -453.4f, 109.5f}, - {238.6f, -460.7f, 109.5f} + { 261.6f, -449.3f, 109.5f, 0.0f }, + { 263.3f, -454.0f, 109.5f, 0.0f }, + { 291.5f, -450.4f, 109.5f, 0.0f }, + { 291.5f, -454.0f, 109.5f, 0.0f }, + { 310.0f, -453.4f, 109.5f, 0.0f }, + { 238.6f, -460.7f, 109.5f, 0.0f } }; enum Phase @@ -83,21 +78,20 @@ enum Phase PHASE_NONE }; +enum Misc +{ + ACTION_NEXT_PHASE, +}; + class boss_palehoof : public CreatureScript { public: boss_palehoof() : CreatureScript("boss_palehoof") { } - CreatureAI* GetAI(Creature* creature) const OVERRIDE + struct boss_palehoofAI : public BossAI { - return new boss_palehoofAI(creature); - } - - struct boss_palehoofAI : public ScriptedAI - { - boss_palehoofAI(Creature* creature) : ScriptedAI(creature) + boss_palehoofAI(Creature* creature) : BossAI(creature, DATA_GORTOK_PALEHOOF) { - instance = creature->GetInstanceScript(); } uint32 uiArcingSmashTimer; @@ -108,10 +102,10 @@ public: uint8 AddCount; Phase Sequence[4]; - InstanceScript* instance; - void Reset() OVERRIDE { + _Reset(); + /// There is a good reason to store them like this, we are going to shuffle the order. for (uint32 i = PHASE_FRENZIED_WORGEN; i < PHASE_GORTOK_PALEHOOF; ++i) Sequence[i] = Phase(i); @@ -129,32 +123,15 @@ public: currentPhase = PHASE_NONE; - if (instance) - { - instance->SetData(DATA_GORTOK_PALEHOOF_EVENT, NOT_STARTED); - - Creature* temp = Unit::GetCreature((*me), instance->GetData64(DATA_NPC_FRENZIED_WORGEN)); - if (temp && !temp->IsAlive()) - temp->Respawn(); + for (uint8 i = DATA_FRENZIED_WORGEN; i <= DATA_FEROCIOUS_RHINO; ++i) + if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetData64(i))) + if (!temp->IsAlive()) + temp->Respawn(); - temp = Unit::GetCreature((*me), instance->GetData64(DATA_NPC_FEROCIOUS_RHINO)); - if (temp && !temp->IsAlive()) - temp->Respawn(); - - temp = Unit::GetCreature((*me), instance->GetData64(DATA_NPC_MASSIVE_JORMUNGAR)); - if (temp && !temp->IsAlive()) - temp->Respawn(); - - temp = Unit::GetCreature((*me), instance->GetData64(DATA_NPC_RAVENOUS_FURBOLG)); - if (temp && !temp->IsAlive()) - temp->Respawn(); - - GameObject* go = instance->instance->GetGameObject(instance->GetData64(DATA_GORTOK_PALEHOOF_SPHERE)); - if (go) - { - go->SetGoState(GO_STATE_READY); - go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); - } + if (GameObject* go = ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_GORTOK_PALEHOOF_SPHERE))) + { + go->SetGoState(GO_STATE_READY); + go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); } } @@ -185,14 +162,9 @@ public: if (currentPhase != PHASE_GORTOK_PALEHOOF) return; - //Return since we have no target if (!UpdateVictim()) return; - Creature* temp = Unit::GetCreature((*me), instance ? instance->GetData64(DATA_NPC_ORB) : 0); - if (temp && temp->IsAlive()) - temp->DisappearAndDie(); - if (uiArcingSmashTimer <= diff) { DoCast(me, SPELL_ARCING_SMASH); @@ -217,12 +189,8 @@ public: void JustDied(Unit* /*killer*/) OVERRIDE { - //Talk(SAY_DEATH); - if (instance) - instance->SetData(DATA_GORTOK_PALEHOOF_EVENT, DONE); - Creature* temp = Unit::GetCreature((*me), instance ? instance->GetData64(DATA_NPC_ORB) : 0); - if (temp && temp->IsAlive()) - temp->DisappearAndDie(); + _JustDied(); + //Talk(SAY_DEATH); } void KilledUnit(Unit* /*victim*/) OVERRIDE @@ -230,28 +198,30 @@ public: Talk(SAY_SLAY); } - void NextPhase() + void DoAction(int32 actionId) OVERRIDE { + if (actionId != ACTION_NEXT_PHASE) + return; + if (currentPhase == PHASE_NONE) { - if (instance) - instance->SetData(DATA_GORTOK_PALEHOOF_EVENT, IN_PROGRESS); + instance->SetBossState(DATA_GORTOK_PALEHOOF, IN_PROGRESS); - me->SummonCreature(NPC_STASIS_CONTROLLER, moveLocs[5].x, moveLocs[5].y, moveLocs[5].z, 0, TEMPSUMMON_CORPSE_DESPAWN); + if (Creature* orb = me->SummonCreature(NPC_STASIS_CONTROLLER, moveLocs[5], TEMPSUMMON_CORPSE_DESPAWN)) + orb->CastSpell(me, SPELL_ORB_VISUAL, true); } + Phase move = PHASE_NONE; if (AddCount >= DUNGEON_MODE(2, 4)) move = PHASE_GORTOK_PALEHOOF; else move = Sequence[AddCount++]; - //send orb to summon spot - Creature* pOrb = Unit::GetCreature((*me), instance ? instance->GetData64(DATA_NPC_ORB) : 0); - if (pOrb && pOrb->IsAlive()) - { - if (currentPhase == PHASE_NONE) - pOrb->CastSpell(me, SPELL_ORB_VISUAL, true); - pOrb->GetMotionMaster()->MovePoint(move, moveLocs[move].x, moveLocs[move].y, moveLocs[move].z); - } + + // send orb to summon spot + if (Creature* orb = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_GORTOK_ORB))) + if (orb->IsAlive()) + orb->GetMotionMaster()->MovePoint(move, moveLocs[move]); + currentPhase = move; } @@ -263,6 +233,10 @@ public: } }; + CreatureAI* GetAI(Creature* creature) const OVERRIDE + { + return GetUtgardePinnacleAI<boss_palehoofAI>(creature); + } }; //ravenous furbolg's spells @@ -305,13 +279,12 @@ public: me->GetMotionMaster()->MoveTargetedHome(); - if (instance) - if (instance->GetData(DATA_GORTOK_PALEHOOF_EVENT) == IN_PROGRESS) - { - Creature* pPalehoof = Unit::GetCreature((*me), instance ? instance->GetData64(DATA_GORTOK_PALEHOOF) : 0); - if (pPalehoof && pPalehoof->IsAlive()) - CAST_AI(boss_palehoof::boss_palehoofAI, pPalehoof->AI())->Reset(); - } + if (instance->GetBossState(DATA_GORTOK_PALEHOOF) == IN_PROGRESS) + { + Creature* palehoof = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_GORTOK_PALEHOOF)); + if (palehoof && palehoof->IsAlive()) + palehoof->AI()->Reset(); + } } void UpdateAI(uint32 diff) OVERRIDE @@ -360,12 +333,8 @@ public: void JustDied(Unit* /*killer*/) OVERRIDE { - if (instance) - { - Creature* pPalehoof = Unit::GetCreature((*me), instance ? instance->GetData64(DATA_GORTOK_PALEHOOF) : 0); - if (pPalehoof) - CAST_AI(boss_palehoof::boss_palehoofAI, pPalehoof->AI())->NextPhase(); - } + if (Creature* palehoof = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_GORTOK_PALEHOOF))) + palehoof->AI()->DoAction(ACTION_NEXT_PHASE); } void JustReachedHome() OVERRIDE @@ -418,13 +387,12 @@ public: me->GetMotionMaster()->MoveTargetedHome(); - if (instance) - if (instance->GetData(DATA_GORTOK_PALEHOOF_EVENT) == IN_PROGRESS) - { - Creature* pPalehoof = Unit::GetCreature((*me), instance ? instance->GetData64(DATA_GORTOK_PALEHOOF) : 0); - if (pPalehoof && pPalehoof->IsAlive()) - CAST_AI(boss_palehoof::boss_palehoofAI, pPalehoof->AI())->Reset(); - } + if (instance->GetBossState(DATA_GORTOK_PALEHOOF) == IN_PROGRESS) + { + Creature* palehoof = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_GORTOK_PALEHOOF)); + if (palehoof && palehoof->IsAlive()) + palehoof->AI()->Reset(); + } } void UpdateAI(uint32 diff) OVERRIDE @@ -470,17 +438,13 @@ public: DoStartMovement(who); } if (instance) - instance->SetData(DATA_GORTOK_PALEHOOF_EVENT, IN_PROGRESS); + instance->SetBossState(DATA_GORTOK_PALEHOOF, IN_PROGRESS); } void JustDied(Unit* /*killer*/) OVERRIDE { - if (instance) - { - Creature* pPalehoof = Unit::GetCreature((*me), instance->GetData64(DATA_GORTOK_PALEHOOF)); - if (pPalehoof) - CAST_AI(boss_palehoof::boss_palehoofAI, pPalehoof->AI())->NextPhase(); - } + if (Creature* palehoof = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_GORTOK_PALEHOOF))) + palehoof->AI()->DoAction(ACTION_NEXT_PHASE); } void JustReachedHome() OVERRIDE @@ -534,13 +498,12 @@ public: me->GetMotionMaster()->MoveTargetedHome(); - if (instance) - if (instance->GetData(DATA_GORTOK_PALEHOOF_EVENT) == IN_PROGRESS) - { - Creature* pPalehoof = Unit::GetCreature((*me), instance ? instance->GetData64(DATA_GORTOK_PALEHOOF) : 0); - if (pPalehoof && pPalehoof->IsAlive()) - CAST_AI(boss_palehoof::boss_palehoofAI, pPalehoof->AI())->Reset(); - } + if (instance->GetBossState(DATA_GORTOK_PALEHOOF) == IN_PROGRESS) + { + Creature* palehoof = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_GORTOK_PALEHOOF)); + if (palehoof && palehoof->IsAlive()) + palehoof->AI()->Reset(); + } } void UpdateAI(uint32 diff) OVERRIDE @@ -590,12 +553,8 @@ public: void JustDied(Unit* /*killer*/) OVERRIDE { - if (instance) - { - Creature* pPalehoof = Unit::GetCreature((*me), instance ? instance->GetData64(DATA_GORTOK_PALEHOOF) : 0); - if (pPalehoof) - CAST_AI(boss_palehoof::boss_palehoofAI, pPalehoof->AI())->NextPhase(); - } + if (Creature* palehoof = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_GORTOK_PALEHOOF))) + palehoof->AI()->DoAction(ACTION_NEXT_PHASE); } void JustReachedHome() OVERRIDE @@ -654,13 +613,12 @@ public: me->GetMotionMaster()->MoveTargetedHome(); - if (instance) - if (instance->GetData(DATA_GORTOK_PALEHOOF_EVENT) == IN_PROGRESS) - { - Creature* pPalehoof = Unit::GetCreature((*me), instance ? instance->GetData64(DATA_GORTOK_PALEHOOF) : 0); - if (pPalehoof && pPalehoof->IsAlive()) - CAST_AI(boss_palehoof::boss_palehoofAI, pPalehoof->AI())->Reset(); - } + if (instance->GetBossState(DATA_GORTOK_PALEHOOF) == IN_PROGRESS) + { + Creature* palehoof = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_GORTOK_PALEHOOF)); + if (palehoof && palehoof->IsAlive()) + palehoof->AI()->Reset(); + } } void UpdateAI(uint32 diff) OVERRIDE @@ -711,12 +669,8 @@ public: void JustDied(Unit* /*killer*/) OVERRIDE { - if (instance) - { - Creature* pPalehoof = Unit::GetCreature((*me), instance ? instance->GetData64(DATA_GORTOK_PALEHOOF) : 0); - if (pPalehoof) - CAST_AI(boss_palehoof::boss_palehoofAI, pPalehoof->AI())->NextPhase(); - } + if (Creature* palehoof = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_GORTOK_PALEHOOF))) + palehoof->AI()->DoAction(ACTION_NEXT_PHASE); } void JustReachedHome() OVERRIDE @@ -767,52 +721,76 @@ public: if (SummonTimer <= diff) { - if (currentPhase<5&¤tPhase >= 0) + uint8 nextBossId = 0; + switch (currentPhase) { - Creature* pNext = NULL; - switch (currentPhase) - { - case PHASE_FRENZIED_WORGEN: pNext = Unit::GetCreature((*me), instance ? instance->GetData64(DATA_NPC_FRENZIED_WORGEN) : 0); break; - case PHASE_RAVENOUS_FURLBORG: pNext = Unit::GetCreature((*me), instance ? instance->GetData64(DATA_NPC_RAVENOUS_FURBOLG) : 0); break; - case PHASE_MASSIVE_JORMUNGAR: pNext = Unit::GetCreature((*me), instance ? instance->GetData64(DATA_NPC_MASSIVE_JORMUNGAR) : 0); break; - case PHASE_FEROCIOUS_RHINO: pNext = Unit::GetCreature((*me), instance ? instance->GetData64(DATA_NPC_FEROCIOUS_RHINO) : 0); break; - case PHASE_GORTOK_PALEHOOF: pNext = Unit::GetCreature((*me), instance ? instance->GetData64(DATA_GORTOK_PALEHOOF) : 0); break; - default: break; - } - - if (pNext) - { - pNext->RemoveAurasDueToSpell(SPELL_FREEZE); - pNext->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_ATTACKABLE_1 | UNIT_FLAG_IMMUNE_TO_PC); - pNext->SetStandState(UNIT_STAND_STATE_STAND); - pNext->SetInCombatWithZone(); - pNext->Attack(pNext->SelectNearestTarget(100), true); - - } - currentPhase = PHASE_NONE; + case PHASE_FRENZIED_WORGEN: + nextBossId = DATA_FRENZIED_WORGEN; + break; + case PHASE_RAVENOUS_FURLBORG: + nextBossId = DATA_RAVENOUS_FURBOLG; + break; + case PHASE_MASSIVE_JORMUNGAR: + nextBossId = DATA_MASSIVE_JORMUNGAR; + break; + case PHASE_FEROCIOUS_RHINO: + nextBossId = DATA_FEROCIOUS_RHINO; + break; + case PHASE_GORTOK_PALEHOOF: + nextBossId = DATA_GORTOK_PALEHOOF; + break; + default: + return; } - } else SummonTimer -= diff; + + if (Creature* nextBoss = ObjectAccessor::GetCreature(*me, instance->GetData64(nextBossId))) + { + nextBoss->RemoveAurasDueToSpell(SPELL_FREEZE); + nextBoss->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_ATTACKABLE_1 | UNIT_FLAG_IMMUNE_TO_PC); + nextBoss->SetStandState(UNIT_STAND_STATE_STAND); + nextBoss->SetInCombatWithZone(); + nextBoss->Attack(nextBoss->SelectNearestTarget(100), true); + } + currentPhase = PHASE_NONE; + + if (nextBossId == DATA_GORTOK_PALEHOOF) + me->DespawnOrUnsummon(); + } + else + SummonTimer -= diff; } void MovementInform(uint32 type, uint32 id) OVERRIDE { if (type != POINT_MOTION_TYPE) return; - if (id > 4) - return; - Creature* pNext = NULL; + + uint8 nextBossId = 0; switch (id) { - case PHASE_FRENZIED_WORGEN: pNext = Unit::GetCreature((*me), instance ? instance->GetData64(DATA_NPC_FRENZIED_WORGEN) : 0); break; - case PHASE_RAVENOUS_FURLBORG: pNext = Unit::GetCreature((*me), instance ? instance->GetData64(DATA_NPC_RAVENOUS_FURBOLG) : 0); break; - case PHASE_MASSIVE_JORMUNGAR: pNext = Unit::GetCreature((*me), instance ? instance->GetData64(DATA_NPC_MASSIVE_JORMUNGAR) : 0); break; - case PHASE_FEROCIOUS_RHINO: pNext = Unit::GetCreature((*me), instance ? instance->GetData64(DATA_NPC_FEROCIOUS_RHINO) : 0); break; - case PHASE_GORTOK_PALEHOOF: pNext = Unit::GetCreature((*me), instance ? instance->GetData64(DATA_GORTOK_PALEHOOF) : 0); break; - default: break; + case PHASE_FRENZIED_WORGEN: + nextBossId = DATA_FRENZIED_WORGEN; + break; + case PHASE_RAVENOUS_FURLBORG: + nextBossId = DATA_RAVENOUS_FURBOLG; + break; + case PHASE_MASSIVE_JORMUNGAR: + nextBossId = DATA_MASSIVE_JORMUNGAR; + break; + case PHASE_FEROCIOUS_RHINO: + nextBossId = DATA_FEROCIOUS_RHINO; + break; + case PHASE_GORTOK_PALEHOOF: + nextBossId = DATA_GORTOK_PALEHOOF; + break; + default: + return; } - if (pNext) - DoCast(pNext, SPELL_ORB_CHANNEL, false); - currentPhase = (Phase)id; + + if (Creature* nextBoss = ObjectAccessor::GetCreature(*me, instance->GetData64(nextBossId))) + DoCast(nextBoss, SPELL_ORB_CHANNEL, false); + + currentPhase = Phase(id); SummonTimer = 5000; } }; @@ -821,23 +799,25 @@ public: class go_palehoof_sphere : public GameObjectScript { -public: - go_palehoof_sphere() : GameObjectScript("go_palehoof_sphere") { } - - bool OnGossipHello(Player* /*player*/, GameObject* go) OVERRIDE - { - InstanceScript* instance = go->GetInstanceScript(); + public: + go_palehoof_sphere() : GameObjectScript("go_palehoof_sphere") { } - Creature* pPalehoof = Unit::GetCreature(*go, instance ? instance->GetData64(DATA_GORTOK_PALEHOOF) : 0); - if (pPalehoof && pPalehoof->IsAlive()) + bool OnGossipHello(Player* /*player*/, GameObject* go) OVERRIDE { - go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); - go->SetGoState(GO_STATE_ACTIVE); + InstanceScript* instance = go->GetInstanceScript(); + if (!instance) + return false; + + Creature* palehoof = ObjectAccessor::GetCreature(*go, instance->GetData64(DATA_GORTOK_PALEHOOF)); + if (palehoof && palehoof->IsAlive()) + { + go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); + go->SetGoState(GO_STATE_ACTIVE); - CAST_AI(boss_palehoof::boss_palehoofAI, pPalehoof->AI())->NextPhase(); + palehoof->AI()->DoAction(ACTION_NEXT_PHASE); + } + return true; } - return true; - } }; diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp index 08670af939a..01fcd9a665d 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp @@ -210,7 +210,7 @@ public: me->SummonCreature(NPC_GRAUF, Location[0].GetPositionX(), Location[0].GetPositionY(), Location[0].GetPositionZ(), 3.0f); if (instance) { - instance->SetData(DATA_SKADI_THE_RUTHLESS_EVENT, NOT_STARTED); + instance->SetBossState(DATA_SKADI_THE_RUTHLESS, NOT_STARTED); instance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); } } @@ -237,7 +237,7 @@ public: me->SetInCombatWithZone(); if (instance) { - instance->SetData(DATA_SKADI_THE_RUTHLESS_EVENT, IN_PROGRESS); + instance->SetBossState(DATA_SKADI_THE_RUTHLESS, IN_PROGRESS); instance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); me->GetMotionMaster()->MoveJump(Location[0].GetPositionX(), Location[0].GetPositionY(), Location[0].GetPositionZ(), 5.0f, 10.0f); me->SetWalk(false); @@ -412,7 +412,7 @@ public: Talk(SAY_DEATH); Summons.DespawnAll(); if (instance) - instance->SetData(DATA_SKADI_THE_RUTHLESS_EVENT, DONE); + instance->SetBossState(DATA_SKADI_THE_RUTHLESS, DONE); } void KilledUnit(Unit* /*victim*/) OVERRIDE diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp index 818631788b6..d518747a462 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp @@ -74,7 +74,6 @@ enum Yells enum Creatures { NPC_ARTHAS = 29280, // Image of Arthas - NPC_SVALA_SORROWGRAVE = 26668, // Svala after transformation NPC_RITUAL_CHANNELER = 27281, NPC_SPECTATOR = 26667, NPC_RITUAL_TARGET = 27327, @@ -82,11 +81,6 @@ enum Creatures NPC_SCOURGE_HULK = 26555 }; -enum GameObjects -{ - GO_UTGARDE_MIRROR = 191745 -}; - enum SvalaPhase { IDLE, @@ -101,191 +95,159 @@ enum Misc DATA_INCREDIBLE_HULK = 2043 }; -static const float spectatorWP[2][3] = +Position const spectatorWP[2] = { - {296.95f, -312.76f, 86.36f}, - {297.69f, -275.81f, 86.36f} + {296.95f, -312.76f, 86.36f, 0.0f }, + {297.69f, -275.81f, 86.36f, 0.0f } }; -static Position ArthasPos = { 295.81f, -366.16f, 92.57f, 1.58f }; +Position const ArthasPos = { 295.81f, -366.16f, 92.57f, 1.58f }; class boss_svala : public CreatureScript { -public: - boss_svala() : CreatureScript("boss_svala") { } - - CreatureAI* GetAI(Creature* creature) const OVERRIDE - { - return new boss_svalaAI(creature); - } + public: + boss_svala() : CreatureScript("boss_svala") { } - struct boss_svalaAI : public ScriptedAI - { - boss_svalaAI(Creature* creature) : ScriptedAI(creature), summons(creature) + struct boss_svalaAI : public BossAI { - instance = creature->GetInstanceScript(); - Phase = IDLE; - - me->ApplySpellImmune(0, IMMUNITY_ID, SPELL_RITUAL_STRIKE_EFF_1, true); - me->ApplySpellImmune(0, IMMUNITY_ID, SPELL_RITUAL_STRIKE_EFF_2, true); - } - - InstanceScript* instance; - SummonList summons; - SvalaPhase Phase; - - Position pos; - float x, y, z; + boss_svalaAI(Creature* creature) : BossAI(creature, DATA_SVALA_SORROWGRAVE) + { + Phase = IDLE; + } - uint32 introTimer; - uint8 introPhase; - uint8 sacrePhase; + SvalaPhase Phase; - TempSummon* arthas; - uint64 arthasGUID; + uint32 introTimer; + uint8 introPhase; + uint8 sacrePhase; - uint32 sinsterStrikeTimer; - uint32 callFlamesTimer; - uint32 sacrificeTimer; + uint64 arthasGUID; - bool sacrificed; + uint32 sinsterStrikeTimer; + uint32 callFlamesTimer; + uint32 sacrificeTimer; - void Reset() OVERRIDE - { - sacrificed = false; - SetCombatMovement(true); + bool sacrificed; - summons.DespawnAll(); - me->RemoveAllAuras(); + void Reset() OVERRIDE + { + _Reset(); + sacrificed = false; + SetCombatMovement(true); - if (Phase > NORMAL) - Phase = NORMAL; + if (Phase > NORMAL) + Phase = NORMAL; - me->SetDisableGravity(Phase == NORMAL); + me->SetDisableGravity(Phase == NORMAL); - introTimer = 1 * IN_MILLISECONDS; - introPhase = 0; - arthasGUID = 0; + introTimer = 1 * IN_MILLISECONDS; + introPhase = 0; + sacrePhase = 0; + arthasGUID = 0; - if (instance) - { - instance->SetData(DATA_SVALA_SORROWGRAVE_EVENT, NOT_STARTED); instance->SetData64(DATA_SACRIFICED_PLAYER, 0); } - } - void EnterCombat(Unit* /*who*/) OVERRIDE - { - Talk(SAY_AGGRO); - - sinsterStrikeTimer = 7 * IN_MILLISECONDS; - callFlamesTimer = urand(10 * IN_MILLISECONDS, 20 * IN_MILLISECONDS); - - if (instance) - instance->SetData(DATA_SVALA_SORROWGRAVE_EVENT, IN_PROGRESS); - } - - void JustSummoned(Creature* summon) OVERRIDE - { - if (summon->GetEntry() == NPC_RITUAL_CHANNELER) - summon->CastSpell(summon, SPELL_SUMMONED_VIS, true); - - summons.Summon(summon); - } + void EnterCombat(Unit* /*who*/) OVERRIDE + { + _EnterCombat(); + Talk(SAY_AGGRO); - void SummonedCreatureDespawn(Creature* summon) OVERRIDE - { - summons.Despawn(summon); - } + sinsterStrikeTimer = 7 * IN_MILLISECONDS; + callFlamesTimer = urand(10 * IN_MILLISECONDS, 20 * IN_MILLISECONDS); + } - void MoveInLineOfSight(Unit* who) OVERRIDE + void JustSummoned(Creature* summon) OVERRIDE + { + if (summon->GetEntry() == NPC_RITUAL_CHANNELER) + summon->CastSpell(summon, SPELL_SUMMONED_VIS, true); - { - if (!who) - return; + summons.Summon(summon); + } - if (Phase == IDLE && me->IsValidAttackTarget(who) && me->IsWithinDistInMap(who, 40)) + void MoveInLineOfSight(Unit* who) OVERRIDE { - Phase = INTRO; - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - - if (GameObject* mirror = GetClosestGameObjectWithEntry(me, GO_UTGARDE_MIRROR, 100.0f)) - mirror->SetGoState(GO_STATE_READY); + if (!who) + return; - if (Creature* arthas = me->SummonCreature(NPC_ARTHAS, ArthasPos, TEMPSUMMON_MANUAL_DESPAWN)) + if (Phase == IDLE && me->IsValidAttackTarget(who) && me->IsWithinDistInMap(who, 40)) { - arthas->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); - arthasGUID = arthas->GetGUID(); - } - } - } + Phase = INTRO; + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - void KilledUnit(Unit* victim) OVERRIDE - { - if (victim != me) - Talk(SAY_SLAY); - } + if (GameObject* mirror = ObjectAccessor::GetGameObject(*me, DATA_UTGARDE_MIRROR)) + mirror->SetGoState(GO_STATE_READY); - void JustDied(Unit* /*killer*/) OVERRIDE - { - if (Phase == SACRIFICING) - SetEquipmentSlots(false, EQUIP_UNEQUIP, EQUIP_NO_CHANGE, EQUIP_NO_CHANGE); + if (Creature* arthas = me->SummonCreature(NPC_ARTHAS, ArthasPos, TEMPSUMMON_MANUAL_DESPAWN)) + { + arthas->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); + arthasGUID = arthas->GetGUID(); + } + } + } - me->HandleEmoteCommand(EMOTE_ONESHOT_FLYDEATH); + void KilledUnit(Unit* who) OVERRIDE + { + if (who->GetTypeId() == TYPEID_PLAYER) + Talk(SAY_SLAY); + } - summons.DespawnAll(); + void JustDied(Unit* /*killer*/) OVERRIDE + { + if (Phase == SACRIFICING) + SetEquipmentSlots(false, EQUIP_UNEQUIP, EQUIP_NO_CHANGE, EQUIP_NO_CHANGE); - if (instance) - instance->SetData(DATA_SVALA_SORROWGRAVE_EVENT, DONE); + me->HandleEmoteCommand(EMOTE_ONESHOT_FLYDEATH); - Talk(SAY_DEATH); - } + _JustDied(); + Talk(SAY_DEATH); + } - void SpellHitTarget(Unit* /*target*/, const SpellInfo* spell) OVERRIDE - { - if (spell->Id == SPELL_RITUAL_STRIKE_EFF_1 && Phase != NORMAL && Phase != SVALADEAD) + void SpellHitTarget(Unit* /*target*/, SpellInfo const* spellInfo) OVERRIDE { - Phase = NORMAL; - SetCombatMovement(true); + if (spellInfo->Id == SPELL_RITUAL_STRIKE_EFF_1 && Phase != NORMAL && Phase != SVALADEAD) + { + Phase = NORMAL; + SetCombatMovement(true); - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 300.0f, true)) - me->GetMotionMaster()->MoveChase(target); + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 300.0f, true)) + me->GetMotionMaster()->MoveChase(target); + } } - } - - void UpdateAI(uint32 diff) OVERRIDE - { - if (Phase == IDLE) - return; - if (Phase == INTRO) + void UpdateAI(uint32 diff) OVERRIDE { - if (introTimer <= diff) - { - Creature* arthas = Unit::GetCreature(*me, arthasGUID); - if (!arthas) - return; + if (Phase == IDLE) + return; - switch (introPhase) + if (Phase == INTRO) + { + if (introTimer <= diff) { - case 0: - Talk(SAY_SVALA_INTRO_0); - ++introPhase; - introTimer = 8100; - break; - case 1: - arthas->AI()->Talk(SAY_DIALOG_OF_ARTHAS_1); - ++introPhase; - introTimer = 10000; - break; - case 2: - arthas->CastSpell(me, SPELL_TRANSFORMING_CHANNEL, false); - pos.Relocate(me); - pos.m_positionZ += 8.0f; - me->GetMotionMaster()->MoveTakeoff(0, pos); - // spectators flee event - if (instance) + Creature* arthas = ObjectAccessor::GetCreature(*me, arthasGUID); + if (!arthas) + return; + + switch (introPhase) + { + case 0: + Talk(SAY_SVALA_INTRO_0); + ++introPhase; + introTimer = 8100; + break; + case 1: + arthas->AI()->Talk(SAY_DIALOG_OF_ARTHAS_1); + ++introPhase; + introTimer = 10000; + break; + case 2: { + arthas->CastSpell(me, SPELL_TRANSFORMING_CHANNEL, false); + Position pos; + pos.Relocate(me); + pos.m_positionZ += 8.0f; + me->GetMotionMaster()->MoveTakeoff(0, pos); + // spectators flee event std::list<Creature*> lspectatorList; GetCreatureListWithEntryInGrid(lspectatorList, me, NPC_SPECTATOR, 100.0f); for (std::list<Creature*>::iterator itr = lspectatorList.begin(); itr != lspectatorList.end(); ++itr) @@ -294,257 +256,258 @@ public: { (*itr)->SetStandState(UNIT_STAND_STATE_STAND); (*itr)->SetWalk(false); - (*itr)->GetMotionMaster()->MovePoint(1, spectatorWP[0][0], spectatorWP[0][1], spectatorWP[0][2]); + (*itr)->GetMotionMaster()->MovePoint(1, spectatorWP[0]); } } + + ++introPhase; + introTimer = 4200; + break; } - ++introPhase; - introTimer = 4200; - break; - case 3: - me->CastSpell(me, SPELL_SVALA_TRANSFORMING1, false); - ++introPhase; - introTimer = 6200; - break; - case 4: - me->CastSpell(me, SPELL_SVALA_TRANSFORMING2, false); - arthas->InterruptNonMeleeSpells(true); - me->RemoveAllAuras(); - me->UpdateEntry(NPC_SVALA_SORROWGRAVE); - me->SetFacingToObject(arthas); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - ++introPhase; - introTimer = 3200; - break; - case 5: - Talk(SAY_SVALA_INTRO_1); - ++introPhase; - introTimer = 10000; - break; - case 6: - arthas->AI()->Talk(SAY_DIALOG_OF_ARTHAS_2); - ++introPhase; - introTimer = 7200; - break; - case 7: - Talk(SAY_SVALA_INTRO_2); - me->SetFacingTo(1.58f); - arthas->SetVisible(false); - ++introPhase; - introTimer = 13800; - break; - case 8: - pos.Relocate(me); - pos.m_positionX = me->GetHomePosition().GetPositionX(); - pos.m_positionY = me->GetHomePosition().GetPositionY(); - pos.m_positionZ = 90.6065f; - me->GetMotionMaster()->MoveLand(0, pos); - me->SetDisableGravity(false, true); - me->SetHover(true); - ++introPhase; - introTimer = 3000; - break; - case 9: - if (GameObject* mirror = GetClosestGameObjectWithEntry(me, GO_UTGARDE_MIRROR, 100.0f)) - mirror->SetGoState(GO_STATE_ACTIVE); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - arthas->DespawnOrUnsummon(); - arthasGUID = 0; - Phase = NORMAL; - break; + case 3: + me->CastSpell(me, SPELL_SVALA_TRANSFORMING1, false); + ++introPhase; + introTimer = 6200; + break; + case 4: + me->CastSpell(me, SPELL_SVALA_TRANSFORMING2, false); + arthas->InterruptNonMeleeSpells(true); + me->RemoveAllAuras(); + me->UpdateEntry(NPC_SVALA_SORROWGRAVE); + me->SetFacingToObject(arthas); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + ++introPhase; + introTimer = 3200; + break; + case 5: + Talk(SAY_SVALA_INTRO_1); + ++introPhase; + introTimer = 10000; + break; + case 6: + arthas->AI()->Talk(SAY_DIALOG_OF_ARTHAS_2); + ++introPhase; + introTimer = 7200; + break; + case 7: + Talk(SAY_SVALA_INTRO_2); + me->SetFacingTo(1.58f); + arthas->SetVisible(false); + ++introPhase; + introTimer = 13800; + break; + case 8: + { + Position pos; + pos.Relocate(me); + pos.m_positionX = me->GetHomePosition().GetPositionX(); + pos.m_positionY = me->GetHomePosition().GetPositionY(); + pos.m_positionZ = 90.6065f; + me->GetMotionMaster()->MoveLand(0, pos); + me->SetDisableGravity(false, true); + me->SetHover(true); + ++introPhase; + introTimer = 3000; + break; + } + case 9: + if (GameObject* mirror = ObjectAccessor::GetGameObject(*me, DATA_UTGARDE_MIRROR)) + mirror->SetGoState(GO_STATE_ACTIVE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + arthas->DespawnOrUnsummon(); + arthasGUID = 0; + Phase = NORMAL; + break; + } } - } - else - introTimer -= diff; - - return; - } + else + introTimer -= diff; - if (Phase == NORMAL) - { - //Return since we have no target - if (!UpdateVictim()) return; - - if (sinsterStrikeTimer <= diff) - { - DoCastVictim(SPELL_SINSTER_STRIKE); - sinsterStrikeTimer = urand(5 * IN_MILLISECONDS, 9 * IN_MILLISECONDS); } - else - sinsterStrikeTimer -= diff; - if (callFlamesTimer <= diff) + if (Phase == NORMAL) { - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true)) + if (!UpdateVictim()) + return; + + if (sinsterStrikeTimer <= diff) { - DoCast(target, SPELL_CALL_FLAMES); - callFlamesTimer = urand(10 * IN_MILLISECONDS, 20 * IN_MILLISECONDS); + DoCastVictim(SPELL_SINSTER_STRIKE); + sinsterStrikeTimer = urand(5 * IN_MILLISECONDS, 9 * IN_MILLISECONDS); } - } - else callFlamesTimer -= diff; + else + sinsterStrikeTimer -= diff; - if (!sacrificed) - { - if (HealthBelowPct(50)) + if (callFlamesTimer <= diff) + { + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true)) + { + DoCast(target, SPELL_CALL_FLAMES); + callFlamesTimer = urand(10 * IN_MILLISECONDS, 20 * IN_MILLISECONDS); + } + } + else + callFlamesTimer -= diff; + + if (!sacrificed) { - if (Unit* sacrificeTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 80.0f, true)) + if (HealthBelowPct(50)) { - if (instance) + if (Unit* sacrificeTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 80.0f, true)) + { instance->SetData64(DATA_SACRIFICED_PLAYER, sacrificeTarget->GetGUID()); - Talk(SAY_SACRIFICE_PLAYER); + Talk(SAY_SACRIFICE_PLAYER); - DoCast(sacrificeTarget, SPELL_RITUAL_PREPARATION); + DoCast(sacrificeTarget, SPELL_RITUAL_PREPARATION); - SetCombatMovement(false); + SetCombatMovement(false); - Phase = SACRIFICING; - sacrePhase = 0; - sacrificeTimer = 1 * IN_MILLISECONDS; + Phase = SACRIFICING; + sacrePhase = 0; + sacrificeTimer = 1 * IN_MILLISECONDS; - DoCast(me, SPELL_RITUAL_OF_THE_SWORD); - sacrificed = true; + DoCast(me, SPELL_RITUAL_OF_THE_SWORD); + sacrificed = true; + } } } - } - DoMeleeAttackIfReady(); - } - else //SACRIFICING - { - if (sacrificeTimer <= diff) + DoMeleeAttackIfReady(); + } + else // SACRIFICING { - switch (sacrePhase) + if (sacrificeTimer <= diff) { - case 0: - // spawn ritual channelers - if (instance) - { + switch (sacrePhase) + { + case 0: + // spawn ritual channelers DoCast(me, SPELL_RITUAL_CHANNELER_1, true); DoCast(me, SPELL_RITUAL_CHANNELER_2, true); DoCast(me, SPELL_RITUAL_CHANNELER_3, true); - } - ++sacrePhase; - sacrificeTimer = 2 * IN_MILLISECONDS; - break; - case 1: - me->StopMoving(); - me->GetMotionMaster()->MoveIdle(); - me->InterruptNonMeleeSpells(true); - DoCast(me, SPELL_RITUAL_STRIKE_TRIGGER, true); - ++sacrePhase; - sacrificeTimer = 200; - break; - case 2: - DoCast(me, SPELL_RITUAL_DISARM); - ++sacrePhase; - break; - case 3: - break; + ++sacrePhase; + sacrificeTimer = 2 * IN_MILLISECONDS; + break; + case 1: + me->StopMoving(); + me->GetMotionMaster()->MoveIdle(); + me->InterruptNonMeleeSpells(true); + DoCast(me, SPELL_RITUAL_STRIKE_TRIGGER, true); + ++sacrePhase; + sacrificeTimer = 200; + break; + case 2: + DoCast(me, SPELL_RITUAL_DISARM); + ++sacrePhase; + break; + case 3: + break; + } } + else + sacrificeTimer -= diff; } - else sacrificeTimer -= diff; } - } - }; + }; + CreatureAI* GetAI(Creature* creature) const OVERRIDE + { + return GetUtgardePinnacleAI<boss_svalaAI>(creature); + } }; class npc_ritual_channeler : public CreatureScript { -public: - npc_ritual_channeler() : CreatureScript("npc_ritual_channeler") { } - - CreatureAI* GetAI(Creature* creature) const OVERRIDE - { - return new npc_ritual_channelerAI(creature); - } + public: + npc_ritual_channeler() : CreatureScript("npc_ritual_channeler") { } - struct npc_ritual_channelerAI : public ScriptedAI - { - npc_ritual_channelerAI(Creature* creature) :ScriptedAI(creature) + struct npc_ritual_channelerAI : public ScriptedAI { - instance = creature->GetInstanceScript(); + npc_ritual_channelerAI(Creature* creature) : ScriptedAI(creature) + { + instance = creature->GetInstanceScript(); - SetCombatMovement(false); - } + SetCombatMovement(false); + } - InstanceScript* instance; - uint32 paralyzeTimer; + InstanceScript* instance; + uint32 paralyzeTimer; + + void Reset() OVERRIDE + { + paralyzeTimer = 1600; - void Reset() OVERRIDE - { - paralyzeTimer = 1600; - if (instance) if (IsHeroic()) DoCast(me, SPELL_SHADOWS_IN_THE_DARK); - } - - void UpdateAI(uint32 diff) OVERRIDE - { - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + } - if (paralyzeTimer <= diff) + void UpdateAI(uint32 diff) OVERRIDE { - if (instance) - if (Unit* victim = me->GetUnit(*me, instance->GetData64(DATA_SACRIFICED_PLAYER))) + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; + + if (paralyzeTimer <= diff) + { + if (Unit* victim = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_SACRIFICED_PLAYER))) DoCast(victim, SPELL_PARALYZE, false); - paralyzeTimer = 200; + paralyzeTimer = 200; + } + else + paralyzeTimer -= diff; } - else - paralyzeTimer -= diff; + }; + + CreatureAI* GetAI(Creature* creature) const OVERRIDE + { + return GetUtgardePinnacleAI<npc_ritual_channelerAI>(creature); } - }; }; class npc_spectator : public CreatureScript { -public: - npc_spectator() : CreatureScript("npc_spectator") { } - - CreatureAI* GetAI(Creature* creature) const OVERRIDE - { - return new npc_spectatorAI(creature); - } + public: + npc_spectator() : CreatureScript("npc_spectator") { } - struct npc_spectatorAI : public ScriptedAI - { - npc_spectatorAI(Creature* creature) : ScriptedAI(creature) { } + struct npc_spectatorAI : public ScriptedAI + { + npc_spectatorAI(Creature* creature) : ScriptedAI(creature) { } - void Reset() OVERRIDE { } + void Reset() OVERRIDE { } - void MovementInform(uint32 motionType, uint32 pointId) OVERRIDE - { - if (motionType == POINT_MOTION_TYPE) + void MovementInform(uint32 motionType, uint32 pointId) OVERRIDE { - if (pointId == 1) - me->GetMotionMaster()->MovePoint(2, spectatorWP[1][0], spectatorWP[1][1], spectatorWP[1][2]); - else if (pointId == 2) - me->DespawnOrUnsummon(1000); + if (motionType == POINT_MOTION_TYPE) + { + if (pointId == 1) + me->GetMotionMaster()->MovePoint(2, spectatorWP[1]); + else if (pointId == 2) + me->DespawnOrUnsummon(1000); + } } + }; + + CreatureAI* GetAI(Creature* creature) const OVERRIDE + { + return GetUtgardePinnacleAI<npc_spectatorAI>(creature); } - }; }; class RitualTargetCheck { public: - explicit RitualTargetCheck(Unit* _caster) : caster(_caster) { } + explicit RitualTargetCheck() { } - bool operator() (WorldObject* unit) const + bool operator() (WorldObject* obj) const { - if (InstanceScript* instance = caster->GetInstanceScript()) - if (instance->GetData64(DATA_SACRIFICED_PLAYER) == unit->GetGUID()) + if (InstanceScript* instance = obj->GetInstanceScript()) + if (instance->GetData64(DATA_SACRIFICED_PLAYER) == obj->GetGUID()) return false; return true; } - - private: - Unit* caster; }; class spell_paralyze_pinnacle : public SpellScriptLoader @@ -558,7 +521,7 @@ class spell_paralyze_pinnacle : public SpellScriptLoader void FilterTargets(std::list<WorldObject*>& unitList) { - unitList.remove_if(RitualTargetCheck(GetCaster())); + unitList.remove_if(RitualTargetCheck()); } void Register() OVERRIDE @@ -635,7 +598,7 @@ class npc_scourge_hulk : public CreatureScript CreatureAI* GetAI(Creature* creature) const OVERRIDE { - return new npc_scourge_hulkAI(creature); + return GetUtgardePinnacleAI<npc_scourge_hulkAI>(creature); } }; diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp index f592a4b2bb2..f4c306c726a 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp @@ -103,16 +103,10 @@ class boss_ymiron : public CreatureScript public: boss_ymiron() : CreatureScript("boss_ymiron") { } - CreatureAI* GetAI(Creature* creature) const OVERRIDE + struct boss_ymironAI : public BossAI { - return new boss_ymironAI(creature); - } - - struct boss_ymironAI : public ScriptedAI - { - boss_ymironAI(Creature* creature) : ScriptedAI(creature) + boss_ymironAI(Creature* creature) : BossAI(creature, DATA_KING_YMIRON) { - instance = creature->GetInstanceScript(); for (int i = 0; i < 4; ++i) m_uiActiveOrder[i] = i; for (int i = 0; i < 3; ++i) @@ -122,9 +116,6 @@ public: m_uiActiveOrder[i] = m_uiActiveOrder[r]; m_uiActiveOrder[r] = temp; } - - m_uiActivedCreatureGUID = 0; - m_uiOrbGUID = 0; } bool m_bIsWalking; @@ -155,10 +146,9 @@ public: uint64 m_uiActivedCreatureGUID; uint64 m_uiOrbGUID; - InstanceScript* instance; - void Reset() OVERRIDE { + _Reset(); m_bIsWalking = false; m_bIsPause = false; m_bIsActiveWithBJORN = false; @@ -182,19 +172,14 @@ public: m_uiHealthAmountModifier = 1; m_uiHealthAmountMultipler = DUNGEON_MODE(20, 25); - DespawnBoatGhosts(m_uiActivedCreatureGUID); - DespawnBoatGhosts(m_uiOrbGUID); - - if (instance) - instance->SetData(DATA_KING_YMIRON_EVENT, NOT_STARTED); + m_uiActivedCreatureGUID = 0; + m_uiOrbGUID = 0; } void EnterCombat(Unit* /*who*/) OVERRIDE { + _EnterCombat(); Talk(SAY_AGGRO); - - if (instance) - instance->SetData(DATA_KING_YMIRON_EVENT, IN_PROGRESS); } void SpellHitTarget(Unit* who, SpellInfo const* spell) OVERRIDE @@ -371,21 +356,17 @@ public: void JustDied(Unit* /*killer*/) OVERRIDE { + _JustDied(); Talk(SAY_DEATH); - - DespawnBoatGhosts(m_uiActivedCreatureGUID); - DespawnBoatGhosts(m_uiOrbGUID); - - if (instance) - instance->SetData(DATA_KING_YMIRON_EVENT, DONE); } - void KilledUnit(Unit* /*victim*/) OVERRIDE + void KilledUnit(Unit* who) OVERRIDE { - Talk(SAY_SLAY); + if (who->GetTypeId() == TYPEID_PLAYER) + Talk(SAY_SLAY); } - void DespawnBoatGhosts(uint64 m_uiCreatureGUID) + void DespawnBoatGhosts(uint64& m_uiCreatureGUID) { if (m_uiCreatureGUID) if (Creature* temp = Unit::GetCreature(*me, m_uiCreatureGUID)) @@ -395,14 +376,16 @@ public: } }; + CreatureAI* GetAI(Creature* creature) const OVERRIDE + { + return GetUtgardePinnacleAI<boss_ymironAI>(creature); + } }; class achievement_kings_bane : public AchievementCriteriaScript { public: - achievement_kings_bane() : AchievementCriteriaScript("achievement_kings_bane") - { - } + achievement_kings_bane() : AchievementCriteriaScript("achievement_kings_bane") { } bool OnCheck(Player* /*player*/, Unit* target) OVERRIDE { diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/instance_utgarde_pinnacle.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/instance_utgarde_pinnacle.cpp index 4959b3a6b58..46fabe41086 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/instance_utgarde_pinnacle.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/instance_utgarde_pinnacle.cpp @@ -19,246 +19,235 @@ #include "InstanceScript.h" #include "utgarde_pinnacle.h" -#define MAX_ENCOUNTER 4 - -/* Utgarde Pinnacle encounters: -0 - Svala Sorrowgrave -1 - Gortok Palehoof -2 - Skadi the Ruthless -3 - King Ymiron -*/ - -enum GameObjects +DoorData const doorData[] = { - ENTRY_SKADI_THE_RUTHLESS_DOOR = 192173, - ENTRY_KING_YMIRON_DOOR = 192174, - ENTRY_GORK_PALEHOOF_SPHERE = 188593 + { GO_SKADI_THE_RUTHLESS_DOOR, DATA_SKADI_THE_RUTHLESS, DOOR_TYPE_PASSAGE, BOUNDARY_W }, + { GO_KING_YMIRON_DOOR, DATA_KING_YMIRON, DOOR_TYPE_PASSAGE, BOUNDARY_N }, + { 0, 0, DOOR_TYPE_ROOM, BOUNDARY_NONE } // END }; class instance_utgarde_pinnacle : public InstanceMapScript { -public: - instance_utgarde_pinnacle() : InstanceMapScript("instance_utgarde_pinnacle", 575) { } - - InstanceScript* GetInstanceScript(InstanceMap* map) const OVERRIDE - { - return new instance_pinnacle(map); - } - - struct instance_pinnacle : public InstanceScript - { - instance_pinnacle(Map* map) : InstanceScript(map) { } - - uint64 uiSvalaSorrowgrave; - uint64 uiGortokPalehoof; - uint64 uiSkadiTheRuthless; - uint64 uiKingYmiron; - - uint64 uiSkadiTheRuthlessDoor; - uint64 uiKingYmironDoor; - uint64 uiGortokPalehoofSphere; + public: + instance_utgarde_pinnacle() : InstanceMapScript(UPScriptName, 575) { } - uint64 uiFrenziedWorgen; - uint64 uiRavenousFurbolg; - uint64 uiFerociousRhino; - uint64 uiMassiveJormungar; - uint64 uiPalehoofOrb; - - uint64 uiSvala; - uint64 uiSacrificedPlayer; - - uint32 m_auiEncounter[MAX_ENCOUNTER]; - - std::string str_data; - - void Initialize() OVERRIDE + struct instance_utgarde_pinnacle_InstanceMapScript : public InstanceScript { - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - m_auiEncounter[i] = NOT_STARTED; - - uiSvalaSorrowgrave = 0; - uiGortokPalehoof = 0; - uiSkadiTheRuthless = 0; - uiKingYmiron = 0; - - uiSkadiTheRuthlessDoor = 0; - uiKingYmironDoor = 0; - uiGortokPalehoofSphere = 0; + instance_utgarde_pinnacle_InstanceMapScript(Map* map) : InstanceScript(map) + { + SetBossNumber(EncounterCount); + LoadDoorData(doorData); - uiFrenziedWorgen = 0; - uiRavenousFurbolg = 0; - uiFerociousRhino = 0; - uiMassiveJormungar = 0; - uiPalehoofOrb = 0; + SvalaSorrowgraveGUID = 0; + GortokPalehoofGUID = 0; + SkadiTheRuthlessGUID = 0; + KingYmironGUID = 0; - uiSvala = 0; - uiSacrificedPlayer = 0; - } + UtgardeMirrorGUID = 0; + GortokPalehoofSphereGUID = 0; - bool IsEncounterInProgress() const OVERRIDE - { - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) - return true; + FrenziedWorgenGUID = 0; + RavenousFurbolgGUID = 0; + FerociousRhinoGUID = 0; + MassiveJormungarGUID = 0; + PalehoofOrbGUID = 0; - return false; - } + SvalaGUID = 0; + SacrificedPlayerGUID = 0; + } - void OnCreatureCreate(Creature* creature) OVERRIDE - { - switch (creature->GetEntry()) + void OnCreatureCreate(Creature* creature) OVERRIDE { - case BOSS_SVALA_SORROWGRAVE: uiSvalaSorrowgrave = creature->GetGUID(); break; - case BOSS_GORTOK_PALEHOOF: uiGortokPalehoof = creature->GetGUID(); break; - case BOSS_SKADI_RUTHLESS: uiSkadiTheRuthless = creature->GetGUID(); break; - case BOSS_KING_YMIRON: uiKingYmiron = creature->GetGUID(); break; - case NPC_FRENZIED_WORGEN: uiFrenziedWorgen = creature->GetGUID(); break; - case NPC_RAVENOUS_FURBOLG: uiRavenousFurbolg = creature->GetGUID(); break; - case NPC_MASSIVE_JORMUNGAR: uiMassiveJormungar = creature->GetGUID(); break; - case NPC_FEROCIOUS_RHINO: uiFerociousRhino = creature->GetGUID(); break; - case NPC_SVALA: uiSvala = creature->GetGUID(); break; - case NPC_PALEHOOF_ORB: uiPalehoofOrb = creature->GetGUID(); break; + switch (creature->GetEntry()) + { + case NPC_SVALA_SORROWGRAVE: + SvalaSorrowgraveGUID = creature->GetGUID(); + break; + case NPC_GORTOK_PALEHOOF: + GortokPalehoofGUID = creature->GetGUID(); + break; + case NPC_SKADI_THE_RUTHLESS: + SkadiTheRuthlessGUID = creature->GetGUID(); + break; + case NPC_KING_YMIRON: + KingYmironGUID = creature->GetGUID(); + break; + case NPC_FRENZIED_WORGEN: + FrenziedWorgenGUID = creature->GetGUID(); + break; + case NPC_RAVENOUS_FURBOLG: + RavenousFurbolgGUID = creature->GetGUID(); + break; + case NPC_MASSIVE_JORMUNGAR: + MassiveJormungarGUID = creature->GetGUID(); + break; + case NPC_FEROCIOUS_RHINO: + FerociousRhinoGUID = creature->GetGUID(); + break; + case NPC_SVALA: + SvalaGUID = creature->GetGUID(); + break; + case NPC_PALEHOOF_ORB: + PalehoofOrbGUID = creature->GetGUID(); + break; + default: + break; + } } - } - void OnGameObjectCreate(GameObject* go) OVERRIDE - { - switch (go->GetEntry()) + void OnGameObjectCreate(GameObject* go) OVERRIDE { - case ENTRY_SKADI_THE_RUTHLESS_DOOR: - uiSkadiTheRuthlessDoor = go->GetGUID(); - if (m_auiEncounter[2] == DONE) HandleGameObject(0, true, go); - break; - case ENTRY_KING_YMIRON_DOOR: - uiKingYmironDoor = go->GetGUID(); - if (m_auiEncounter[3] == DONE) HandleGameObject(0, true, go); - break; - case ENTRY_GORK_PALEHOOF_SPHERE: - uiGortokPalehoofSphere = go->GetGUID(); - if (m_auiEncounter[1] == DONE) - { - HandleGameObject(0, true, go); - go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); - } - break; + switch (go->GetEntry()) + { + case GO_UTGARDE_MIRROR: + UtgardeMirrorGUID = go->GetGUID(); + break; + case GO_GORTOK_PALEHOOF_SPHERE: + GortokPalehoofSphereGUID = go->GetGUID(); + if (GetBossState(DATA_GORTOK_PALEHOOF) == DONE) + { + HandleGameObject(0, true, go); + go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); + } + break; + case GO_SKADI_THE_RUTHLESS_DOOR: + case GO_KING_YMIRON_DOOR: + AddDoor(go, true); + break; + default: + break; + } } - } - void SetData(uint32 type, uint32 data) OVERRIDE - { - switch (type) + void OnGameObjectRemove(GameObject* go) OVERRIDE { - case DATA_SVALA_SORROWGRAVE_EVENT: - m_auiEncounter[0] = data; - break; - case DATA_GORTOK_PALEHOOF_EVENT: - m_auiEncounter[1] = data; - break; - case DATA_SKADI_THE_RUTHLESS_EVENT: - if (data == DONE) - HandleGameObject(uiSkadiTheRuthlessDoor, true); - m_auiEncounter[2] = data; - break; - case DATA_KING_YMIRON_EVENT: - if (data == DONE) - HandleGameObject(uiKingYmironDoor, true); - m_auiEncounter[3] = data; - break; + switch (go->GetEntry()) + { + case GO_SKADI_THE_RUTHLESS_DOOR: + case GO_KING_YMIRON_DOOR: + AddDoor(go, false); + break; + default: + break; + } } - if (data == DONE) - SaveToDB(); - } - - void SetData64(uint32 type, uint64 data) OVERRIDE - { - switch (type) + void SetData64(uint32 type, uint64 data) OVERRIDE { - case DATA_SACRIFICED_PLAYER: - uiSacrificedPlayer = data; - break; + switch (type) + { + case DATA_SACRIFICED_PLAYER: + SacrificedPlayerGUID = data; + break; + default: + break; + } } - } - uint32 GetData(uint32 type) const OVERRIDE - { - switch (type) + uint64 GetData64(uint32 type) const OVERRIDE { - case DATA_SVALA_SORROWGRAVE_EVENT: return m_auiEncounter[0]; - case DATA_GORTOK_PALEHOOF_EVENT: return m_auiEncounter[1]; - case DATA_SKADI_THE_RUTHLESS_EVENT: return m_auiEncounter[2]; - case DATA_KING_YMIRON_EVENT: return m_auiEncounter[3]; + switch (type) + { + case DATA_SVALA_SORROWGRAVE: + return SvalaSorrowgraveGUID; + case DATA_GORTOK_PALEHOOF: + return GortokPalehoofGUID; + case DATA_SKADI_THE_RUTHLESS: + return SkadiTheRuthlessGUID; + case DATA_KING_YMIRON: + return KingYmironGUID; + case DATA_FRENZIED_WORGEN: + return FrenziedWorgenGUID; + case DATA_RAVENOUS_FURBOLG: + return RavenousFurbolgGUID; + case DATA_MASSIVE_JORMUNGAR: + return MassiveJormungarGUID; + case DATA_FEROCIOUS_RHINO: + return FerociousRhinoGUID; + case DATA_GORTOK_ORB: + return PalehoofOrbGUID; + case DATA_GORTOK_PALEHOOF_SPHERE: + return GortokPalehoofSphereGUID; + case DATA_UTGARDE_MIRROR: + return UtgardeMirrorGUID; + case DATA_SVALA: + return SvalaGUID; + case DATA_SACRIFICED_PLAYER: + return SacrificedPlayerGUID; + default: + break; + } + + return 0; } - return 0; - } - uint64 GetData64(uint32 identifier) const OVERRIDE - { - switch (identifier) + std::string GetSaveData() OVERRIDE { - case DATA_SVALA_SORROWGRAVE: return uiSvalaSorrowgrave; - case DATA_GORTOK_PALEHOOF: return uiGortokPalehoof; - case DATA_SKADI_THE_RUTHLESS: return uiSkadiTheRuthless; - case DATA_KING_YMIRON: return uiKingYmiron; - case DATA_NPC_FRENZIED_WORGEN: return uiFrenziedWorgen; - case DATA_NPC_RAVENOUS_FURBOLG: return uiRavenousFurbolg; - case DATA_NPC_MASSIVE_JORMUNGAR: return uiMassiveJormungar; - case DATA_NPC_FEROCIOUS_RHINO: return uiFerociousRhino; - case DATA_NPC_ORB: return uiPalehoofOrb; - case DATA_SVALA: return uiSvala; - case DATA_GORTOK_PALEHOOF_SPHERE: return uiGortokPalehoofSphere; - case DATA_SACRIFICED_PLAYER: return uiSacrificedPlayer; + OUT_SAVE_INST_DATA; + + std::ostringstream saveStream; + saveStream << "U P " << GetBossSaveData(); + + OUT_SAVE_INST_DATA_COMPLETE; + return saveStream.str(); } - return 0; - } + void Load(char const* str) OVERRIDE + { + if (!str) + { + OUT_LOAD_INST_DATA_FAIL; + return; + } - std::string GetSaveData() OVERRIDE - { - OUT_SAVE_INST_DATA; + OUT_LOAD_INST_DATA(str); - std::ostringstream saveStream; - saveStream << "U P " << m_auiEncounter[0] << ' ' << m_auiEncounter[1] << ' ' - << m_auiEncounter[2] << ' ' << m_auiEncounter[3]; + char dataHead1, dataHead2; - str_data = saveStream.str(); + std::istringstream loadStream(str); + loadStream >> dataHead1 >> dataHead2; - OUT_SAVE_INST_DATA_COMPLETE; - return str_data; - } + if (dataHead1 == 'U' && dataHead2 == 'P') + { + for (uint32 i = 0; i < EncounterCount; ++i) + { + uint32 tmpState; + loadStream >> tmpState; + if (tmpState == IN_PROGRESS || tmpState > SPECIAL) + tmpState = NOT_STARTED; + SetBossState(i, EncounterState(tmpState)); + } + } + else + OUT_LOAD_INST_DATA_FAIL; - void Load(const char* in) OVERRIDE - { - if (!in) - { - OUT_LOAD_INST_DATA_FAIL; - return; + OUT_LOAD_INST_DATA_COMPLETE; } - OUT_LOAD_INST_DATA(in); + protected: + uint64 SvalaSorrowgraveGUID; + uint64 GortokPalehoofGUID; + uint64 SkadiTheRuthlessGUID; + uint64 KingYmironGUID; - char dataHead1, dataHead2; - uint16 data0, data1, data2, data3; + uint64 UtgardeMirrorGUID; + uint64 GortokPalehoofSphereGUID; - std::istringstream loadStream(in); - loadStream >> dataHead1 >> dataHead2 >> data0 >> data1 >> data2 >> data3; + uint64 FrenziedWorgenGUID; + uint64 RavenousFurbolgGUID; + uint64 FerociousRhinoGUID; + uint64 MassiveJormungarGUID; - if (dataHead1 == 'U' && dataHead2 == 'P') - { - m_auiEncounter[0] = data0; - m_auiEncounter[1] = data1; - m_auiEncounter[2] = data2; - m_auiEncounter[3] = data3; + uint64 PalehoofOrbGUID; - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) - m_auiEncounter[i] = NOT_STARTED; + uint64 SvalaGUID; + uint64 SacrificedPlayerGUID; + }; - } else OUT_LOAD_INST_DATA_FAIL; - - OUT_LOAD_INST_DATA_COMPLETE; + InstanceScript* GetInstanceScript(InstanceMap* map) const OVERRIDE + { + return new instance_utgarde_pinnacle_InstanceMapScript(map); } - }; }; void AddSC_instance_utgarde_pinnacle() diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/utgarde_pinnacle.h b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/utgarde_pinnacle.h index 6166b7c4891..ddf1d1e512a 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/utgarde_pinnacle.h +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/utgarde_pinnacle.h @@ -15,46 +15,64 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef DEF_PINNACLE_H -#define DEF_PINNACLE_H +#ifndef UTGARDE_PINNACLE_H_ +#define UTGARDE_PINNACLE_H_ -enum Data +#define UPScriptName "instance_utgarde_pinnacle" + +uint32 const EncounterCount = 4; + +enum DataTypes { - DATA_SVALA_SORROWGRAVE_EVENT, - DATA_GORTOK_PALEHOOF_EVENT, - DATA_SKADI_THE_RUTHLESS_EVENT, - DATA_KING_YMIRON_EVENT + // Encounter States/Boss GUIDs + DATA_SVALA_SORROWGRAVE = 0, + DATA_GORTOK_PALEHOOF = 1, + DATA_SKADI_THE_RUTHLESS = 2, + DATA_KING_YMIRON = 3, + + // Additional Data + DATA_UTGARDE_MIRROR = 4, + DATA_SVALA = 5, + DATA_SACRIFICED_PLAYER = 6, + + DATA_FRENZIED_WORGEN = 7, + DATA_RAVENOUS_FURBOLG = 8, + DATA_MASSIVE_JORMUNGAR = 9, + DATA_FEROCIOUS_RHINO = 10, + DATA_GORTOK_ORB = 11, + DATA_GORTOK_PALEHOOF_SPHERE = 12 }; -enum Data64 +enum CreatureIds { - DATA_SVALA, - DATA_SVALA_SORROWGRAVE, - DATA_GORTOK_PALEHOOF, - DATA_SKADI_THE_RUTHLESS, - DATA_NPC_GRAUF, - DATA_KING_YMIRON, - DATA_NPC_FRENZIED_WORGEN, - DATA_NPC_RAVENOUS_FURBOLG, - DATA_NPC_MASSIVE_JORMUNGAR, - DATA_NPC_FEROCIOUS_RHINO, - DATA_NPC_ORB, - DATA_GORTOK_PALEHOOF_SPHERE, - DATA_SACRIFICED_PLAYER + NPC_SVALA_SORROWGRAVE = 26668, + NPC_GORTOK_PALEHOOF = 26687, + NPC_SKADI_THE_RUTHLESS = 26693, + NPC_KING_YMIRON = 26861, + + // Svala + NPC_SVALA = 29281, + + // Gortok Palehoof + NPC_FRENZIED_WORGEN = 26683, + NPC_RAVENOUS_FURBOLG = 26684, + NPC_MASSIVE_JORMUNGAR = 26685, + NPC_FEROCIOUS_RHINO = 26686, + NPC_PALEHOOF_ORB = 26688 }; -enum CreatureID +enum GameObjectIds { - BOSS_SVALA_SORROWGRAVE = 26668, - BOSS_GORTOK_PALEHOOF = 26687, - BOSS_SKADI_RUTHLESS = 26693, - BOSS_KING_YMIRON = 26861, - NPC_FRENZIED_WORGEN = 26683, - NPC_RAVENOUS_FURBOLG = 26684, - NPC_MASSIVE_JORMUNGAR = 26685, - NPC_FEROCIOUS_RHINO = 26686, - NPC_SVALA = 29281, - NPC_PALEHOOF_ORB = 26688 + GO_GORTOK_PALEHOOF_SPHERE = 188593, + GO_UTGARDE_MIRROR = 191745, + GO_SKADI_THE_RUTHLESS_DOOR = 192173, + GO_KING_YMIRON_DOOR = 192174 }; -#endif +template<class AI> +AI* GetUtgardePinnacleAI(Creature* creature) +{ + return GetInstanceAI<AI>(creature, UPScriptName); +} + +#endif // UTGARDE_PINNACLE_H_ diff --git a/src/server/scripts/Northrend/zone_dalaran.cpp b/src/server/scripts/Northrend/zone_dalaran.cpp index 99dd9569504..3a0984e4c44 100644 --- a/src/server/scripts/Northrend/zone_dalaran.cpp +++ b/src/server/scripts/Northrend/zone_dalaran.cpp @@ -64,11 +64,11 @@ public: creature->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_MAGIC, true); } - void Reset()OVERRIDE { } + void Reset() OVERRIDE { } - void EnterCombat(Unit* /*who*/)OVERRIDE { } + void EnterCombat(Unit* /*who*/) OVERRIDE { } - void AttackStart(Unit* /*who*/)OVERRIDE { } + void AttackStart(Unit* /*who*/) OVERRIDE { } void MoveInLineOfSight(Unit* who) OVERRIDE @@ -118,7 +118,7 @@ public: return; } - void UpdateAI(uint32 /*diff*/)OVERRIDE { } + void UpdateAI(uint32 /*diff*/) OVERRIDE { } }; CreatureAI* GetAI(Creature* creature) const OVERRIDE diff --git a/src/server/scripts/Northrend/zone_dragonblight.cpp b/src/server/scripts/Northrend/zone_dragonblight.cpp index 0357ea075f4..76ce586aa9d 100644 --- a/src/server/scripts/Northrend/zone_dragonblight.cpp +++ b/src/server/scripts/Northrend/zone_dragonblight.cpp @@ -303,10 +303,111 @@ class npc_wyrmrest_defender : public CreatureScript } }; +/*##### +# npc_torturer_lecraft +#####*/ + +enum TorturerLeCraft +{ + SPELL_HEMORRHAGE = 30478, + SPELL_KIDNEY_SHOT = 30621, + SPELL_HIGH_EXECUTORS_BRANDING_IRON = 48603, + NPC_TORTURER_LECRAFT = 27394, + EVENT_HEMORRHAGE = 1, + EVENT_KIDNEY_SHOT = 2, + SAY_AGGRO = 0 +}; + +class npc_torturer_lecraft : public CreatureScript +{ + public: npc_torturer_lecraft() : CreatureScript("npc_torturer_lecraft") {} + + struct npc_torturer_lecraftAI : public ScriptedAI + { + npc_torturer_lecraftAI(Creature* creature) : ScriptedAI(creature) { } + + void Reset() OVERRIDE + { + _textCounter = 1; + _playerGUID = 0; + } + + void EnterCombat(Unit* who) OVERRIDE + { + _events.ScheduleEvent(EVENT_HEMORRHAGE, urand(5000, 8000)); + _events.ScheduleEvent(EVENT_KIDNEY_SHOT, urand(12000, 15000)); + + if (Player* player = who->ToPlayer()) + Talk (SAY_AGGRO, player->GetGUID()); + } + + void SpellHit(Unit* caster, const SpellInfo* spell) OVERRIDE + { + if (spell->Id != SPELL_HIGH_EXECUTORS_BRANDING_IRON) + return; + + if (Player* player = caster->ToPlayer()) + { + if (_textCounter == 1) + _playerGUID = player->GetGUID(); + + if (_playerGUID != player->GetGUID()) + return; + + Talk(_textCounter, player->GetGUID()); + + if (_textCounter == 5) + player->KilledMonsterCredit(NPC_TORTURER_LECRAFT, 0); + + ++_textCounter; + + if (_textCounter == 13) + _textCounter = 6; + } + } + + void UpdateAI(uint32 diff) OVERRIDE + { + if (!UpdateVictim()) + return; + + _events.Update(diff); + + while (uint32 eventId = _events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_HEMORRHAGE: + DoCastVictim(SPELL_HEMORRHAGE); + _events.ScheduleEvent(EVENT_HEMORRHAGE, urand(12000, 168000)); + break; + case EVENT_KIDNEY_SHOT: + DoCastVictim(SPELL_KIDNEY_SHOT); + _events.ScheduleEvent(EVENT_KIDNEY_SHOT, urand(20000, 26000)); + break; + default: + break; + } + } + DoMeleeAttackIfReady(); + } + private: + EventMap _events; + uint8 _textCounter; + uint64 _playerGUID; + }; + + CreatureAI* GetAI(Creature* creature) const + { + return new npc_torturer_lecraftAI(creature); + } +}; + void AddSC_dragonblight() { new npc_alexstrasza_wr_gate; new spell_q12096_q12092_dummy; new spell_q12096_q12092_bark; new npc_wyrmrest_defender; + new npc_torturer_lecraft; } diff --git a/src/server/scripts/Northrend/zone_grizzly_hills.cpp b/src/server/scripts/Northrend/zone_grizzly_hills.cpp index 9ea3023de01..6587f0536b3 100644 --- a/src/server/scripts/Northrend/zone_grizzly_hills.cpp +++ b/src/server/scripts/Northrend/zone_grizzly_hills.cpp @@ -20,7 +20,9 @@ #include "ScriptedCreature.h" #include "ScriptedEscortAI.h" #include "Player.h" +#include "Spell.h" #include "SpellInfo.h" +#include "SpellScript.h" #include "CreatureTextMgr.h" /*###### @@ -749,6 +751,43 @@ public: } }; +enum ShredderDelivery +{ + NPC_BROKEN_DOWN_SHREDDER = 27354 +}; + +class spell_shredder_delivery : public SpellScriptLoader +{ + public: + spell_shredder_delivery() : SpellScriptLoader("spell_shredder_delivery") { } + + class spell_shredder_delivery_SpellScript : public SpellScript + { + PrepareSpellScript(spell_shredder_delivery_SpellScript); + + bool Load() OVERRIDE + { + return GetCaster()->GetTypeId() == TYPEID_UNIT; + } + + void HandleScript(SpellEffIndex /*effIndex*/) + { + if (GetCaster()->ToCreature()->GetEntry() == NPC_BROKEN_DOWN_SHREDDER) + GetCaster()->ToCreature()->DespawnOrUnsummon(); + } + + void Register() OVERRIDE + { + OnEffectHitTarget += SpellEffectFn(spell_shredder_delivery_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; + + SpellScript* GetSpellScript() const OVERRIDE + { + return new spell_shredder_delivery_SpellScript(); + } +}; + void AddSC_grizzly_hills() { new npc_emily(); @@ -759,4 +798,5 @@ void AddSC_grizzly_hills() new npc_wounded_skirmisher(); new npc_venture_co_straggler(); new npc_lake_frog(); + new spell_shredder_delivery(); } diff --git a/src/server/scripts/Northrend/zone_icecrown.cpp b/src/server/scripts/Northrend/zone_icecrown.cpp index d952321c749..5c65be982e0 100644 --- a/src/server/scripts/Northrend/zone_icecrown.cpp +++ b/src/server/scripts/Northrend/zone_icecrown.cpp @@ -25,91 +25,6 @@ #include "CombatAI.h" /*###### -## npc_arete -######*/ - -#define GOSSIP_ARETE_ITEM1 "Lord-Commander, I would hear your tale." -#define GOSSIP_ARETE_ITEM2 "<You nod slightly but do not complete the motion as the Lord-Commander narrows his eyes before he continues.>" -#define GOSSIP_ARETE_ITEM3 "I thought that they now called themselves the Scarlet Onslaught?" -#define GOSSIP_ARETE_ITEM4 "Where did the grand admiral go?" -#define GOSSIP_ARETE_ITEM5 "That's fine. When do I start?" -#define GOSSIP_ARETE_ITEM6 "Let's finish this!" -#define GOSSIP_ARETE_ITEM7 "That's quite a tale, Lord-Commander." - -enum Arete -{ - GOSSIP_TEXTID_ARETE1 = 13525, - GOSSIP_TEXTID_ARETE2 = 13526, - GOSSIP_TEXTID_ARETE3 = 13527, - GOSSIP_TEXTID_ARETE4 = 13528, - GOSSIP_TEXTID_ARETE5 = 13529, - GOSSIP_TEXTID_ARETE6 = 13530, - GOSSIP_TEXTID_ARETE7 = 13531, - - QUEST_THE_STORY_THUS_FAR = 12807 -}; - -class npc_arete : public CreatureScript -{ -public: - npc_arete() : CreatureScript("npc_arete") { } - - bool OnGossipHello(Player* player, Creature* creature) OVERRIDE - { - if (creature->IsQuestGiver()) - player->PrepareQuestMenu(creature->GetGUID()); - - if (player->GetQuestStatus(QUEST_THE_STORY_THUS_FAR) == QUEST_STATUS_INCOMPLETE) - { - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ARETE_ITEM1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - player->SEND_GOSSIP_MENU(GOSSIP_TEXTID_ARETE1, creature->GetGUID()); - return true; - } - - player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); - return true; - } - - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) OVERRIDE - { - player->PlayerTalkClass->ClearMenus(); - switch (action) - { - case GOSSIP_ACTION_INFO_DEF+1: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ARETE_ITEM2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - player->SEND_GOSSIP_MENU(GOSSIP_TEXTID_ARETE2, creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+2: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ARETE_ITEM3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); - player->SEND_GOSSIP_MENU(GOSSIP_TEXTID_ARETE3, creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+3: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ARETE_ITEM4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4); - player->SEND_GOSSIP_MENU(GOSSIP_TEXTID_ARETE4, creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+4: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ARETE_ITEM5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5); - player->SEND_GOSSIP_MENU(GOSSIP_TEXTID_ARETE5, creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+5: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ARETE_ITEM6, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 6); - player->SEND_GOSSIP_MENU(GOSSIP_TEXTID_ARETE6, creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+6: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ARETE_ITEM7, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 7); - player->SEND_GOSSIP_MENU(GOSSIP_TEXTID_ARETE7, creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+7: - player->CLOSE_GOSSIP_MENU(); - player->AreaExploredOrEventHappens(QUEST_THE_STORY_THUS_FAR); - break; - } - - return true; - } -}; - -/*###### ## npc_squire_david ######*/ @@ -483,7 +398,7 @@ class npc_tournament_training_dummy : public CreatureScript me->SetControlled(true, UNIT_STATE_STUNNED); } - void MoveInLineOfSight(Unit* /*who*/)OVERRIDE { } + void MoveInLineOfSight(Unit* /*who*/) OVERRIDE { } }; @@ -1149,7 +1064,6 @@ class npc_morbidus : public CreatureScript void AddSC_icecrown() { - new npc_arete; new npc_squire_david; new npc_argent_valiant; new npc_guardian_pavilion; diff --git a/src/server/scripts/Northrend/zone_sholazar_basin.cpp b/src/server/scripts/Northrend/zone_sholazar_basin.cpp index 77b85037a01..a0b6524bd89 100644 --- a/src/server/scripts/Northrend/zone_sholazar_basin.cpp +++ b/src/server/scripts/Northrend/zone_sholazar_basin.cpp @@ -1082,6 +1082,57 @@ public: } }; +/*###### +## Quest Dreadsaber Mastery: Stalking the Prey (12550) +######*/ + +enum ShangoTracks +{ + SPELL_CORRECT_TRACKS = 52160, + SPELL_INCORRECT_TRACKS = 52163, + SAY_CORRECT_TRACKS = 28634, + SAY_INCORRECT_TRACKS = 28635 +}; + +class spell_shango_tracks : public SpellScriptLoader +{ +public: + spell_shango_tracks() : SpellScriptLoader("spell_shango_tracks") { } + + class spell_shango_tracks_SpellScript : public SpellScript + { + PrepareSpellScript(spell_shango_tracks_SpellScript); + + void HandleScript(SpellEffIndex /*effIndex*/) + { + if (Player* player = GetHitUnit()->ToPlayer()) + { + switch (GetSpellInfo()->Id) + { + case SPELL_CORRECT_TRACKS: + player->MonsterSay(sObjectMgr->GetTrinityStringForDBCLocale(SAY_CORRECT_TRACKS), LANG_UNIVERSAL, player->GetGUID()); + break; + case SPELL_INCORRECT_TRACKS: + player->MonsterSay(sObjectMgr->GetTrinityStringForDBCLocale(SAY_INCORRECT_TRACKS), LANG_UNIVERSAL, player->GetGUID()); + break; + default: + break; + } + } + } + + void Register() OVERRIDE + { + OnEffectHitTarget += SpellEffectFn(spell_shango_tracks_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; + + SpellScript* GetSpellScript() const OVERRIDE + { + return new spell_shango_tracks_SpellScript(); + } +}; + void AddSC_sholazar_basin() { new npc_injured_rainspeaker_oracle(); @@ -1095,4 +1146,5 @@ void AddSC_sholazar_basin() new spell_q12589_shoot_rjr(); new npc_haiphoon(); new npc_vics_flying_machine(); + new spell_shango_tracks(); } diff --git a/src/server/scripts/Northrend/zone_storm_peaks.cpp b/src/server/scripts/Northrend/zone_storm_peaks.cpp index 83d49045eff..825981ba5c5 100644 --- a/src/server/scripts/Northrend/zone_storm_peaks.cpp +++ b/src/server/scripts/Northrend/zone_storm_peaks.cpp @@ -460,6 +460,52 @@ class spell_close_rift : public SpellScriptLoader } }; +/*##### +# spell_jokkum_scriptcast +#####*/ + +enum JokkumScriptcast +{ + SPELL_JOKKUM_KILL_CREDIT = 56545, + SPELL_JOKKUM_SUMMON = 56541 +}; + +class spell_jokkum_scriptcast : public SpellScriptLoader +{ + public: spell_jokkum_scriptcast() : SpellScriptLoader("spell_jokkum_scriptcast") { } + + class spell_jokkum_scriptcast_AuraScript : public AuraScript + { + PrepareAuraScript(spell_jokkum_scriptcast_AuraScript); + + bool Validate(SpellInfo const* /*spellInfo*/) OVERRIDE + { + if (!sSpellMgr->GetSpellInfo(SPELL_JOKKUM_KILL_CREDIT) || !sSpellMgr->GetSpellInfo(SPELL_JOKKUM_SUMMON)) + return false; + return true; + } + + void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + if (Player* player = GetTarget()->ToPlayer()) + { + player->CastSpell(player, SPELL_JOKKUM_KILL_CREDIT, true); + player->CastSpell(player, SPELL_JOKKUM_SUMMON, true); + } + } + + void Register() OVERRIDE + { + OnEffectApply += AuraEffectApplyFn(spell_jokkum_scriptcast_AuraScript::OnApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + } + }; + + AuraScript* GetAuraScript() const OVERRIDE + { + return new spell_jokkum_scriptcast_AuraScript(); + } +}; + void AddSC_storm_peaks() { new npc_injured_goblin(); @@ -469,4 +515,5 @@ void AddSC_storm_peaks() new npc_icefang(); new npc_hyldsmeet_protodrake(); new spell_close_rift(); + new spell_jokkum_scriptcast(); } diff --git a/src/server/scripts/Northrend/zone_zuldrak.cpp b/src/server/scripts/Northrend/zone_zuldrak.cpp index 66415448d32..00adfa59d8d 100644 --- a/src/server/scripts/Northrend/zone_zuldrak.cpp +++ b/src/server/scripts/Northrend/zone_zuldrak.cpp @@ -57,16 +57,15 @@ public: float x, y, z; me->GetClosePoint(x, y, z, me->GetObjectSize() / 3, 0.1f); - if (Unit* summon = me->SummonCreature(NPC_RAGECLAW, x, y, z, 0, TEMPSUMMON_DEAD_DESPAWN, 1000)) + if (Creature* summon = me->SummonCreature(NPC_RAGECLAW, x, y, z, 0, TEMPSUMMON_DEAD_DESPAWN, 1000)) { _rageclawGUID = summon->GetGUID(); - LockRageclaw(); + LockRageclaw(summon); } } - void LockRageclaw() + void LockRageclaw(Creature* rageclaw) { - Unit* rageclaw = Unit::GetCreature(*me, _rageclawGUID); // pointer check not needed me->SetInFront(rageclaw); rageclaw->SetInFront(me); @@ -75,12 +74,11 @@ public: DoCast(rageclaw, SPELL_RIGHT_CHAIN, true); } - void UnlockRageclaw(Unit* who) + void UnlockRageclaw(Unit* who, Creature* rageclaw) { if (!who) return; - Creature* rageclaw = Unit::GetCreature(*me, _rageclawGUID); // pointer check not needed DoCast(rageclaw, SPELL_FREE_RAGECLAW, true); @@ -95,7 +93,7 @@ public: { if (Creature* rageclaw = Unit::GetCreature(*me, _rageclawGUID)) { - UnlockRageclaw(caster); + UnlockRageclaw(caster, rageclaw); caster->ToPlayer()->KilledMonster(rageclaw->GetCreatureTemplate(), _rageclawGUID); me->DespawnOrUnsummon(); } @@ -141,8 +139,7 @@ public: DoCast(me, SPELL_KNEEL, true); // Little Hack for kneel - Thanks Illy :P } - void MoveInLineOfSight(Unit* /*who*/)OVERRIDE { } - + void MoveInLineOfSight(Unit* /*who*/) OVERRIDE { } void SpellHit(Unit* /*caster*/, const SpellInfo* spell) OVERRIDE { @@ -166,982 +163,6 @@ public: } }; -/*#### -## npc_gurgthock -####*/ - -enum Gurgthock -{ - QUEST_AMPHITHEATER_ANGUISH_TUSKARRMAGEDDON = 12935, - QUEST_AMPHITHEATER_ANGUISH_KORRAK_BLOODRAGER = 12936, - QUEST_AMPHITHEATER_ANGUISH_YGGDRAS_2 = 12954, - QUEST_AMPHITHEATER_ANGUISH_YGGDRAS_1 = 12932, - QUEST_AMPHITHEATER_ANGUISH_MAGNATAUR = 12933, - QUEST_AMPHITHEATER_ANGUISH_FROM_BEYOND = 12934, - - NPC_ORINOKO_TUSKBREAKER = 30020, - NPC_KORRAK_BLOODRAGER = 30023, - NPC_YGGDRAS = 30014, - NPC_STINKBEARD = 30017, - NPC_AZ_BARIN = 30026, // air - NPC_DUKE_SINGEN = 30019, // fire - NPC_ERATHIUS = 30025, // earth - NPC_GARGORAL = 30024, // water - NPC_FIEND_WATER = 30044, - NPC_FIEND_AIR = 30045, - NPC_FIEND_FIRE = 30042, - NPC_FIEND_EARTH = 30043, - - SAY_QUEST_ACCEPT_TUSKARRMAGEDON = 0, - SAY_QUEST_ACCEPT_KORRAK_1 = 1, - SAY_QUEST_ACCEPT_KORRAK_2 = 2, - SAY_QUEST_ACCEPT_MAGNATAUR = 3, - EMOTE_YGGDRAS_SPAWN = 4, - SAY_STINKBEARD_SPAWN = 5, - SAY_GURGTHOCK_ELEMENTAL_SPAWN = 6, - SAY_GURGTHOCK_7 = 7, - SAY_QUEST_AMPHITHEATER_ANGUISH_YGGDRAS = 8, - SAY_GURGTHOCK_9 = 9, - - SAY_CALL_FOR_HELP = 0, - SAY_RECRUIT = 0, - - SPELL_CRASHING_WAVE = 55909, // water - SPELL_SHOCKWAVE = 55918, // earth - SPELL_BLAST_OF_AIR = 55912, // air - SPELL_MAGMA_WAVE = 55916, // fire - - SPELL_ORB_OF_WATER = 55888, // fiend of water spell - SPELL_ORB_OF_STORMS = 55882, // fiend of air spell - SPELL_BOULDER = 55886, // fiend of earth spell - SPELL_ORB_OF_FLAME = 55872, // fiend of fire spell -}; - -struct BossAndAdd -{ - uint32 uiBoss; - uint32 uiAdd; - uint32 uiSpell; - uint32 uiAddSpell; -}; - -static BossAndAdd Boss[]= -{ - {NPC_GARGORAL, NPC_FIEND_WATER, SPELL_CRASHING_WAVE, SPELL_ORB_OF_WATER}, - {NPC_AZ_BARIN, NPC_FIEND_AIR, SPELL_BLAST_OF_AIR, SPELL_ORB_OF_STORMS}, - {NPC_DUKE_SINGEN, NPC_FIEND_FIRE, SPELL_MAGMA_WAVE, SPELL_ORB_OF_FLAME}, - {NPC_ERATHIUS, NPC_FIEND_EARTH, SPELL_SHOCKWAVE, SPELL_BOULDER}, -}; - -const Position SpawnPosition[] = -{ - {5754.692f, -2939.46f, 286.276123f, 5.156380f}, // stinkbeard || orinoko || korrak - {5762.054199f, -2954.385010f, 273.826955f, 5.108289f}, //yggdras - {5776.855f, -2989.77979f, 272.96814f, 5.194f} // elementals -}; - -const Position AddSpawnPosition[] = -{ - {5722.487f, -3010.75f, 312.751648f, 0.478f}, // caster location - {5724.983f, -2969.89551f, 286.359619f, 0.478f}, - {5733.76025f, -3000.34644f, 286.359619f, 0.478f}, - {5739.8125f, -2981.524f, 290.7671f, 0.478f}, // caster location - {5742.101f, -2950.75586f, 286.2643f, 5.21f}, - {5743.305f, -3011.29736f, 290.7671f, 0.478f}, // caster location - {5744.417f, -3025.528f, 286.35965f, 0.478f}, - {5763.189f, -3029.67529f, 290.7671f, 0.478f}, - {5769.401f, -2935.121f, 286.335754f, 5.21f}, - {5793.061f, -2934.593f, 286.359619f, 3.53f}, - {5797.32129f, -2955.26855f, 290.7671f, 3.53f}, // caster location - {5813.94531f, -2956.74683f, 286.359619f, 3.53f}, - {5816.85547f, -2974.476f, 290.7671f, 3.53f}, // caster location - {5820.30859f, -3002.83716f, 290.7671f, 3.53f}, // caster location - {5828.50244f, -2981.737f, 286.359619f, 3.53f}, - {5828.899f, -2960.15479f, 312.751648f, 3.53f}, // caster location -}; - -class npc_gurgthock : public CreatureScript -{ -public: - npc_gurgthock() : CreatureScript("npc_gurgthock") { } - - struct npc_gurgthockAI : public ScriptedAI - { - npc_gurgthockAI(Creature* creature) : ScriptedAI(creature) { } - - void Reset() OVERRIDE - { - _summonGUID = 0; - _playerGUID = 0; - - me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); - uiTimer = 0; - uiPhase = 0; - uiQuest = 0; - uiRemoveFlagTimer = 5000; - - _bossRandom = 0; - - _removeFlag = false; - } - - void SetGUID(uint64 guid, int32 /*id*/) OVERRIDE - { - _playerGUID = guid; - } - - void SetData(uint32 type, uint32 data) OVERRIDE - { - _removeFlag = true; - me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); - - switch (type) - { - case 1: - switch (data) - { - case QUEST_AMPHITHEATER_ANGUISH_TUSKARRMAGEDDON: - Talk(SAY_QUEST_ACCEPT_TUSKARRMAGEDON); - uiPhase = 1; - uiTimer = 4000; - break; - case QUEST_AMPHITHEATER_ANGUISH_KORRAK_BLOODRAGER: - Talk(SAY_QUEST_ACCEPT_KORRAK_1); - uiPhase = 3; - uiTimer = 3000; - break; - case QUEST_AMPHITHEATER_ANGUISH_YGGDRAS_2: - case QUEST_AMPHITHEATER_ANGUISH_YGGDRAS_1: - uiPhase = 6; - uiTimer = 3000; - break; - case QUEST_AMPHITHEATER_ANGUISH_MAGNATAUR: - uiTimer = 5000; - uiPhase = 7; - break; - case QUEST_AMPHITHEATER_ANGUISH_FROM_BEYOND: - uiTimer = 2000; - uiPhase = 12; - break; - } - break; - } - } - - void UpdateAI(uint32 diff) OVERRIDE - { - ScriptedAI::UpdateAI(diff); - - if (_removeFlag) - { - if (uiRemoveFlagTimer <= diff) - { - me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); - _removeFlag = false; - - uiRemoveFlagTimer = 10000; - } else uiRemoveFlagTimer -= diff; - } - - if (uiPhase) - { - if (uiTimer <= diff) - { - switch (uiPhase) - { - case 1: - if (Creature* summon = me->SummonCreature(NPC_ORINOKO_TUSKBREAKER, SpawnPosition[0], TEMPSUMMON_CORPSE_DESPAWN, 1000)) - _summonGUID = summon->GetGUID(); - uiPhase = 2; - uiTimer = 4000; - break; - case 2: - if (Creature* summon = Unit::GetCreature(*me, _summonGUID)) - summon->GetMotionMaster()->MoveJump(5776.319824f, -2981.005371f, 273.100037f, 10.0f, 20.0f); - uiPhase = 0; - _summonGUID = 0; - break; - case 3: - Talk(SAY_QUEST_ACCEPT_KORRAK_2); - uiTimer = 3000; - uiPhase = 4; - break; - case 4: - if (Creature* summon = me->SummonCreature(NPC_KORRAK_BLOODRAGER, SpawnPosition[0], TEMPSUMMON_CORPSE_DESPAWN, 1000)) - _summonGUID = summon->GetGUID(); - uiTimer = 3000; - uiPhase = 0; - break; - case 6: - Talk(SAY_GURGTHOCK_7, _playerGUID); - uiTimer = 5000; - uiPhase = 9; - break; - case 7: - Talk(SAY_GURGTHOCK_9, _playerGUID); - uiTimer = 3000; - uiPhase = 8; - break; - case 8: - Talk(SAY_QUEST_ACCEPT_MAGNATAUR); - uiTimer = 5000; - uiPhase = 11; - break; - case 9: - Talk(SAY_QUEST_AMPHITHEATER_ANGUISH_YGGDRAS, _playerGUID); - uiTimer = 10000; - uiPhase = 10; - break; - case 10: - me->SummonCreature(NPC_YGGDRAS, SpawnPosition[1], TEMPSUMMON_CORPSE_DESPAWN, 1000); - Talk(EMOTE_YGGDRAS_SPAWN); - uiPhase = 0; - break; - case 11: - if (Creature* creature = me->SummonCreature(NPC_STINKBEARD, SpawnPosition[0], TEMPSUMMON_CORPSE_DESPAWN, 1000)) - creature->AI()->Talk(SAY_STINKBEARD_SPAWN); - uiPhase = 0; - break; - case 12: - Talk(SAY_GURGTHOCK_9, _playerGUID); - uiTimer = 5000; - uiPhase = 13; - break; - case 13: - Talk(SAY_GURGTHOCK_ELEMENTAL_SPAWN); - uiTimer = 3000; - uiPhase = 14; - break; - case 14: - _bossRandom = urand(0, 3); - if (Creature* creature = me->SummonCreature(Boss[_bossRandom].uiBoss, SpawnPosition[2], TEMPSUMMON_CORPSE_DESPAWN, 1000)) - creature->AI()->SetData(1, _bossRandom); - uiPhase = 0; - break; - } - } - else - uiTimer -= diff; - } - } - - private: - bool _removeFlag; - uint8 _bossRandom; - uint64 _summonGUID; - uint64 _playerGUID; - - uint32 uiTimer; - uint32 uiPhase; - uint32 uiRemoveFlagTimer; - uint32 uiQuest; - - }; - - bool OnQuestAccept(Player* player, Creature* creature, Quest const* quest) OVERRIDE - { - switch (quest->GetQuestId()) - { - case QUEST_AMPHITHEATER_ANGUISH_TUSKARRMAGEDDON: - creature->AI()->SetData(1, quest->GetQuestId()); - break; - case QUEST_AMPHITHEATER_ANGUISH_KORRAK_BLOODRAGER: - creature->AI()->SetData(1, quest->GetQuestId()); - break; - case QUEST_AMPHITHEATER_ANGUISH_YGGDRAS_2: - case QUEST_AMPHITHEATER_ANGUISH_YGGDRAS_1: - creature->AI()->SetData(1, quest->GetQuestId()); - break; - case QUEST_AMPHITHEATER_ANGUISH_MAGNATAUR: - creature->AI()->SetData(1, quest->GetQuestId()); - break; - case QUEST_AMPHITHEATER_ANGUISH_FROM_BEYOND: - creature->AI()->SetData(1, quest->GetQuestId()); - break; - } - - creature->AI()->SetGUID(player->GetGUID()); - - return false; - } - - CreatureAI* GetAI(Creature* creature) const OVERRIDE - { - return new npc_gurgthockAI(creature); - } -}; - -/*#### -## npc_orinoko_tuskbreaker -####*/ - -enum OrinokoTuskbreaker -{ - NPC_WHISKER = 30113, - NPC_HUNGRY_PENGUIN = 30110, - - SPELL_BATTLE_SHOUT = 32064, - SPELL_FISHY_SCENT = 55937, - SPELL_IMPALE = 55929, - SPELL_SUMMON_WHISKER = 55946 -}; - -class npc_orinoko_tuskbreaker : public CreatureScript -{ -public: - npc_orinoko_tuskbreaker() : CreatureScript("npc_orinoko_tuskbreaker") { } - - struct npc_orinoko_tuskbreakerAI : public ScriptedAI - { - npc_orinoko_tuskbreakerAI(Creature* creature) : ScriptedAI(creature) - { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); - me->SetReactState(REACT_PASSIVE); - } - - void Reset() OVERRIDE - { - _summoned = false; - _battleShout = false; - _fishyScent = false; - uiBattleShoutTimer = 0; - uiFishyScentTimer = 20000; - _whiskerGUID = 0; - _affectedGUID = 0; - } - - void EnterEvadeMode() OVERRIDE - { - if (Creature* whisker = me->GetCreature(*me, _whiskerGUID)) - whisker->RemoveFromWorld(); - } - - void MovementInform(uint32 type, uint32 /*pointId*/) OVERRIDE - { - if (type != EFFECT_MOTION_TYPE) - return; - - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); - me->SetReactState(REACT_AGGRESSIVE); - me->SetHomePosition(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation()); - uiBattleShoutTimer = 7000; - } - - void EnterCombat(Unit* who) OVERRIDE - { - DoCast(who, SPELL_IMPALE); - } - - void UpdateAI(uint32 diff) OVERRIDE - { - if (!UpdateVictim()) - return; - - if (!_battleShout && uiBattleShoutTimer <= diff) - { - DoCast(me, SPELL_BATTLE_SHOUT); - _battleShout = true; - } else uiBattleShoutTimer -= diff; - - if (uiFishyScentTimer <= diff) - { - if (Unit* affected = SelectTarget(SELECT_TARGET_RANDOM, 0)) - { - DoCast(affected, SPELL_FISHY_SCENT); - _affectedGUID = affected->GetGUID(); - } - uiFishyScentTimer = 20000; - } else uiFishyScentTimer -= diff; - - if (!_summoned && !HealthAbovePct(50)) - { - Talk(SAY_CALL_FOR_HELP); - //DoCastVictim(SPELL_SUMMON_WHISKER); petai is not working correctly??? - - if (Creature* whisker = me->SummonCreature(NPC_WHISKER, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 0)) - _whiskerGUID = whisker->GetGUID(); - _summoned = true; - } - - DoMeleeAttackIfReady(); - } - - void JustSummoned(Creature* summon) OVERRIDE - { - switch (summon->GetEntry()) - { - case NPC_WHISKER: - summon->AI()->AttackStart(me->GetVictim()); - break; - case NPC_HUNGRY_PENGUIN: - if (Unit* affected = Unit::GetUnit(*me, _affectedGUID)) - { - if (affected->IsAlive()) - summon->AI()->AttackStart(affected); - } - break; - } - } - - void JustDied(Unit* killer) OVERRIDE - { - if (_whiskerGUID) - if (Creature* whisker = me->GetCreature(*me, _whiskerGUID)) - whisker->RemoveFromWorld(); - - if (killer->GetTypeId() == TYPEID_PLAYER) - killer->GetCharmerOrOwnerPlayerOrPlayerItself()->GroupEventHappens(QUEST_AMPHITHEATER_ANGUISH_TUSKARRMAGEDDON, killer); - - } - - private: - bool _summoned; - bool _battleShout; - bool _fishyScent; - uint32 uiBattleShoutTimer; - uint32 uiFishyScentTimer; - uint64 _affectedGUID; - uint64 _whiskerGUID; - }; - - CreatureAI* GetAI(Creature* creature) const OVERRIDE - { - return new npc_orinoko_tuskbreakerAI(creature); - } -}; - -/*#### -## npc_korrak_bloodrager -####*/ - -enum KorrakBloodrager -{ - SPELL_GROW = 55948, - SPELL_CHARGE = 24193, - SPELL_UPPERCUT = 30471, - SPELL_ENRAGE = 42745 -}; - -class npc_korrak_bloodrager : public CreatureScript -{ -public: - npc_korrak_bloodrager() : CreatureScript("npc_korrak_bloodrager") { } - - struct npc_korrak_bloodragerAI : public npc_escortAI - { - npc_korrak_bloodragerAI(Creature* creature) : npc_escortAI(creature) - { - Start(true, true, 0, NULL); - SetDespawnAtEnd(false); - } - - void Reset() OVERRIDE - { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); - me->SetReactState(REACT_PASSIVE); - _enrage = false; - _chargeTimer = 15000; - _uppercutTimer = 12000; - - } - - void WaypointReached(uint32 waypointId) OVERRIDE - { - switch (waypointId) - { - case 6: - me->SetHomePosition(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); - me->SetReactState(REACT_AGGRESSIVE); - break; - } - } - - void EnterCombat(Unit* /*who*/) OVERRIDE - { - DoCast(me, SPELL_GROW); - } - - void UpdateAI(uint32 diff) OVERRIDE - { - npc_escortAI::UpdateAI(diff); - - if (!UpdateVictim()) - return; - - if (_uppercutTimer <= diff) - { - if (Unit* target = SelectTarget(SELECT_TARGET_NEAREST, 0)) - DoCast(target, SPELL_UPPERCUT); - _uppercutTimer = 12000; - } else _uppercutTimer -= diff; - - if (_chargeTimer <= diff) - { - if (Unit* target = SelectTarget(SELECT_TARGET_FARTHEST, 0)) - DoCast(target, SPELL_CHARGE); - _chargeTimer = 15000; - } else _chargeTimer -= diff; - - if (!_enrage && !HealthAbovePct(20)) - { - DoCast(me, SPELL_ENRAGE); - _enrage = true; - } - DoMeleeAttackIfReady(); - } - - void JustDied(Unit* killer) OVERRIDE - { - if (Player* player = killer->GetCharmerOrOwnerPlayerOrPlayerItself()) - player->GroupEventHappens(QUEST_AMPHITHEATER_ANGUISH_KORRAK_BLOODRAGER, killer); - } - private: - bool _enrage; - uint32 _chargeTimer; - uint32 _uppercutTimer; - }; - - CreatureAI* GetAI(Creature* creature) const OVERRIDE - { - return new npc_korrak_bloodragerAI(creature); - } -}; - -/*#### -## npc_yggdras -####*/ - -enum Yggdras -{ - SPELL_CLEAVE = 40504, - SPELL_CORRODE_FLESH = 57076, - SPELL_JORMUNGAR_SPAWN = 55859 -}; - -class npc_yggdras : public CreatureScript -{ -public: - npc_yggdras() : CreatureScript("npc_yggdras") { } - - struct npc_yggdrasAI : public ScriptedAI - { - npc_yggdrasAI(Creature* creature) : ScriptedAI(creature) { } - - void Reset() OVERRIDE - { - _cleaveTimer = 9000; - _corrodeFleshTimer = 6000; - } - - void UpdateAI(uint32 diff) OVERRIDE - { - if (!UpdateVictim()) - return; - - if (me->GetVictim()->GetPositionZ() >= 286.276f) - { - std::list<HostileReference*> t_list = me->getThreatManager().getThreatList(); - for (std::list<HostileReference*>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) - { - if (Unit* unit = Unit::GetUnit(*me, (*itr)->getUnitGuid())) - { - if (unit->GetPositionZ() <= 286.276f) - { - me->getThreatManager().resetAllAggro(); - me->AddThreat(unit, 5.0f); - break; - } - EnterEvadeMode(); - } - } - } - - if (_cleaveTimer <= diff) - { - DoCastVictim(SPELL_CLEAVE); - _cleaveTimer = 9000; - } else _cleaveTimer -= diff; - - if (_corrodeFleshTimer <= diff) - { - DoCastVictim(SPELL_CORRODE_FLESH); - _corrodeFleshTimer = 6000; - } else _corrodeFleshTimer -= diff; - - DoMeleeAttackIfReady(); - } - - void JustDied(Unit* killer) OVERRIDE - { - if (Unit* summoner = me->ToTempSummon()->GetSummoner()) - { - std::string sText = (std::string(killer->GetName()) + " has defeated Yg.. Yggg-really big worm!"); - summoner->MonsterYell(sText.c_str(), LANG_UNIVERSAL, 0); - } - - if (Player* player = killer->GetCharmerOrOwnerPlayerOrPlayerItself()) - { - player->GroupEventHappens(QUEST_AMPHITHEATER_ANGUISH_YGGDRAS_1, killer); - player->GroupEventHappens(QUEST_AMPHITHEATER_ANGUISH_YGGDRAS_2, killer); - } - - for (uint8 i = 0; i < 3; ++i) - DoCast(killer, SPELL_JORMUNGAR_SPAWN, true); - } - private: - uint32 _cleaveTimer; - uint32 _corrodeFleshTimer; - }; - - CreatureAI* GetAI(Creature* creature) const OVERRIDE - { - return new npc_yggdrasAI(creature); - } -}; - -/*#### -## npc_stinkbeard -####*/ - -enum Stinkbeard -{ - SPELL_ENRAGE_STINKBEARD = 50420, - SPELL_KNOCK_AWAY = 31389, - SPELL_STINKY_BEARD = 55867, - SPELL_THUNDERBLADE = 55866, - SPELL_THUNDERCLAP = 15588 -}; - -class npc_stinkbeard : public CreatureScript -{ -public: - npc_stinkbeard() : CreatureScript("npc_stinkbeard") { } - - struct npc_stinkbeardAI : public npc_escortAI - { - npc_stinkbeardAI(Creature* creature) : npc_escortAI(creature) - { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); - me->SetReactState(REACT_PASSIVE); - Start(true, true, 0, NULL); - SetDespawnAtEnd(false); - } - - void Reset() OVERRIDE - { - me->AddAura(SPELL_THUNDERBLADE, me); - uiKnockAwayTimer = 10000; - uiStinkyBeardTimer = 15000; - _enrage = false; - _thunderClap = false; - } - - void WaypointReached(uint32 waypointId) OVERRIDE - { - switch (waypointId) - { - case 7: - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); - me->SetReactState(REACT_AGGRESSIVE); - me->SetHomePosition(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation()); - break; - } - } - - void UpdateAI(uint32 uiDiff) OVERRIDE - { - npc_escortAI::UpdateAI(uiDiff); - - if (!UpdateVictim()) - return; - - if (Unit* victim = me->GetVictim()) - { - if (victim->GetPositionZ() >= 286.276f) - { - std::list<HostileReference*> t_list = me->getThreatManager().getThreatList(); - for (std::list<HostileReference*>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) - { - if (Unit* unit = Unit::GetUnit(*me, (*itr)->getUnitGuid())) - { - if (unit->GetPositionZ() <= 286.276f) - { - me->getThreatManager().resetAllAggro(); - me->AddThreat(unit, 5.0f); - break; - } - EnterEvadeMode(); - } - } - } - } - - if (_thunderClap && !HealthAbovePct(10)) - { - DoCastAOE(SPELL_THUNDERCLAP); - _thunderClap = true; - } - - if (uiKnockAwayTimer <= uiDiff) - { - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - { - if (target && target->IsAlive()) - DoCast(target, SPELL_KNOCK_AWAY); - } - uiKnockAwayTimer = 10000; - } else uiKnockAwayTimer -= uiDiff; - - if (uiStinkyBeardTimer <= uiDiff) - { - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - { - if (target && target->IsAlive()) - DoCast(target, SPELL_STINKY_BEARD); - } - uiStinkyBeardTimer = 15000; - } else uiStinkyBeardTimer -= uiDiff; - - if (!_enrage && !HealthAbovePct(20)) - { - DoCast(me, SPELL_ENRAGE_STINKBEARD); - _enrage = true; - } - DoMeleeAttackIfReady(); - } - - void JustDied(Unit* killer) OVERRIDE - { - if (Player* player = killer->GetCharmerOrOwnerPlayerOrPlayerItself()) - player->GetCharmerOrOwnerPlayerOrPlayerItself()->GroupEventHappens(QUEST_AMPHITHEATER_ANGUISH_MAGNATAUR, killer); - - std::string sText = ("And with AUTHORITY, " + std::string(killer->GetName()) + " dominates the magnataur lord! Stinkbeard's clan is gonna miss him back home in the Dragonblight!"); - me->MonsterYell(sText.c_str(), LANG_UNIVERSAL, 0); - } - private: - bool _enrage; - bool _thunderClap; - uint32 uiKnockAwayTimer; - uint32 uiStinkyBeardTimer; - }; - - CreatureAI* GetAI(Creature* creature) const OVERRIDE - { - return new npc_stinkbeardAI(creature); - } -}; - -/*#### -## npc_elemental_lord -####*/ - -class npc_elemental_lord : public CreatureScript -{ -public: - npc_elemental_lord() : CreatureScript("npc_elemental_lord") { } - - struct npc_elemental_lordAI : public ScriptedAI - { - npc_elemental_lordAI(Creature* creature) : ScriptedAI(creature) { } - - std::list<uint64> SummonList; - - uint32 uiElementalSpellTimer; - - uint8 uiBossRandom; - uint32 uiSpellInfo; - - bool bAddAttack; - - void Reset() OVERRIDE - { - uiBossRandom = 0; - uiSpellInfo = 0; - uiElementalSpellTimer = urand(5000, 8000); - - bAddAttack = false; - } - - void SetData(uint32 uiData, uint32 uiValue) OVERRIDE - { - if (uiData == 1) - { - uiBossRandom = uiValue; - SummonAdds(); - } - } - - void SummonAdds() - { - if (!Boss[uiBossRandom].uiAdd) - return; - - SummonList.clear(); - - for (uint8 uiI = 0; uiI < 16; uiI++) - { - if (Creature* summon = me->SummonCreature(Boss[uiBossRandom].uiAdd, AddSpawnPosition[uiI])) - { - summon->AI()->SetData(1, uiBossRandom); - SummonList.push_back(summon->GetGUID()); - } - } - - } - - void EnterCombat(Unit* unit) OVERRIDE - { - if (!SummonList.empty()) - for (std::list<uint64>::const_iterator itr = SummonList.begin(); itr != SummonList.end(); ++itr) - { - if (Creature* temp = Unit::GetCreature(*me, *itr)) - { - temp->m_CombatDistance = 100.0f; // ugly hack? we are not in a instance sorry. :( - temp->AI()->AttackStart(unit); - } - } - } - - void UpdateAI(uint32 uiDiff) OVERRIDE - { - if (!UpdateVictim()) - return; - - if (me->GetVictim()->GetPositionZ() >= 286.276f) - { - std::list<HostileReference*> t_list = me->getThreatManager().getThreatList(); - for (std::list<HostileReference*>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) - { - if (Unit* unit = Unit::GetUnit(*me, (*itr)->getUnitGuid())) - { - if (unit->GetPositionZ() <= 286.276f) - { - me->getThreatManager().resetAllAggro(); - me->AddThreat(unit, 5.0f); - break; - } - EnterEvadeMode(); - } - } - } - - if (uiElementalSpellTimer <= uiDiff) - { - DoCastVictim(Boss[uiBossRandom].uiSpell); - - uiElementalSpellTimer = urand(5000, 8000); - } else uiElementalSpellTimer -= uiDiff; - - if (!bAddAttack && !HealthAbovePct(20)) - { - if (!SummonList.empty()) - for (std::list<uint64>::const_iterator itr = SummonList.begin(); itr != SummonList.end(); ++itr) - { - if (Creature* temp = Unit::GetCreature(*me, *itr)) - { - if (temp->GetPositionZ() >= 287.00f) - continue; - - if (temp->GetVictim()) - temp->GetMotionMaster()->MoveChase(temp->GetVictim()); - } - } - - bAddAttack = true; - } - - DoMeleeAttackIfReady(); - } - - void JustDied(Unit* killer) OVERRIDE - { - if (!SummonList.empty()) - for (std::list<uint64>::const_iterator itr = SummonList.begin(); itr != SummonList.end(); ++itr) - if (Creature* temp = Unit::GetCreature(*me, *itr)) - temp->DespawnOrUnsummon(); - - if (Player* player = killer->GetCharmerOrOwnerPlayerOrPlayerItself()) - player->GetCharmerOrOwnerPlayerOrPlayerItself()->GroupEventHappens(QUEST_AMPHITHEATER_ANGUISH_FROM_BEYOND, killer); - - std::string sText = (std::string(killer->GetName()) + " is victorious once more!"); - - if (Unit* summoner = me->ToTempSummon()->GetSummoner()) - summoner->MonsterYell(sText.c_str(), LANG_UNIVERSAL, 0); - } - }; - - CreatureAI* GetAI(Creature* creature) const OVERRIDE - { - return new npc_elemental_lordAI(creature); - } -}; - -/*#### -## npc_fiend_elemental -####*/ - -class npc_fiend_elemental : public CreatureScript -{ -public: - npc_fiend_elemental() : CreatureScript("npc_fiend_elemental") { } - - struct npc_fiend_elementalAI : public ScriptedAI - { - npc_fiend_elementalAI(Creature* creature) : ScriptedAI(creature) { } - - void Reset() OVERRIDE - { - if (me->GetPositionZ() >= 287.0f) - me->GetMotionMaster()->MoveIdle(); - - _spell = 0; - _missleTimer = urand(2000, 7000); - } - - void AttackStart(Unit* who) OVERRIDE - { - if (!who) - return; - - AttackStartNoMove(who); - } - - void SetData(uint32 Data, uint32 Value) OVERRIDE - { - if (Data == 1) - _spell = Boss[Value].uiAddSpell; - - } - - void UpdateAI(uint32 diff) OVERRIDE - { - if (!UpdateVictim()) - return; - - if (me->GetPositionZ() >= 287.0f) - { - if (_missleTimer <= diff) - { - if (_spell) // Sometimes it is 0, why? - DoCast(me, _spell); // this spell (what spell) is not supported ... YET! - _missleTimer = urand(2000, 7000); - } else _missleTimer -= diff; - } - - DoMeleeAttackIfReady(); - } - - private: - uint32 _missleTimer; - uint32 _spell; - }; - - CreatureAI* GetAI(Creature* creature) const OVERRIDE - { - return new npc_fiend_elementalAI(creature); - } -}; /*#### ## npc_released_offspring_harkoa @@ -1184,7 +205,8 @@ public: enum CrusadeRecruit { SPELL_QUEST_CREDIT = 50633, - QUEST_TROLL_PATROL_INTESTINAL_FORTITUDE = 12509 + QUEST_TROLL_PATROL_INTESTINAL_FORTITUDE = 12509, + SAY_RECRUIT = 0 }; enum CrusadeRecruitEvents @@ -1867,15 +889,8 @@ void AddSC_zuldrak() { new npc_drakuru_shackles(); new npc_captured_rageclaw(); - new npc_gurgthock(); - new npc_orinoko_tuskbreaker(); - new npc_korrak_bloodrager(); - new npc_yggdras(); - new npc_stinkbeard(); new npc_released_offspring_harkoa(); new npc_crusade_recruit(); - new npc_elemental_lord(); - new npc_fiend_elemental(); new go_scourge_enclosure(); new npc_alchemist_finklestein(); new go_finklesteins_cauldron(); |
