diff options
| -rw-r--r-- | sql/scripts/world_scripts_full.sql | 16 | ||||
| -rw-r--r-- | sql/updates/world/2011_03_26_0_world_achievement_criteria_data.sql | 29 | ||||
| -rwxr-xr-x | src/server/game/AI/CreatureAI.h | 6 | ||||
| -rwxr-xr-x | src/server/game/AI/CreatureAIImpl.h | 18 | ||||
| -rw-r--r-- | src/server/scripts/Northrend/Ulduar/ulduar/boss_flame_leviathan.cpp | 1653 | ||||
| -rw-r--r-- | src/server/scripts/Northrend/Ulduar/ulduar/boss_razorscale.cpp | 4 | ||||
| -rw-r--r-- | src/server/scripts/Northrend/Ulduar/ulduar/instance_ulduar.cpp | 16 | ||||
| -rw-r--r-- | src/server/scripts/Northrend/Ulduar/ulduar/ulduar.h | 14 |
8 files changed, 944 insertions, 812 deletions
diff --git a/sql/scripts/world_scripts_full.sql b/sql/scripts/world_scripts_full.sql index 7188af722f4..724d88af5fa 100644 --- a/sql/scripts/world_scripts_full.sql +++ b/sql/scripts/world_scripts_full.sql @@ -1764,7 +1764,7 @@ UPDATE `outdoorpvp_template` SET `ScriptName`='outdoorpvp_si' WHERE `TypeId`=5; UPDATE `outdoorpvp_template` SET `ScriptName`='outdoorpvp_ep' WHERE `TypeId`=6; /* ACHIEVEMENTS */ -DELETE FROM `achievement_criteria_data` WHERE `criteria_id` IN (3693,6641,6642,6643,6644,3804,3805,3806,3807,3808,3809,3810,3811,3812,3813,1234,1239,5605,5606,12778,13036,13035,13037,12977,12967,12986,12982,12993,12780,13012,13011,13013,12062,12063,12064,12065,12183,12068,12060,12061,12822,12996,12972,12989) AND `type` IN (0,11); +DELETE FROM `achievement_criteria_data` WHERE `criteria_id` IN (3693,6641,6642,6643,6644,3804,3805,3806,3807,3808,3809,3810,3811,3812,3813,1234,1239,5605,5606,12778,13036,13035,13037,12977,12967,12986,12982,12993,12780,13012,13011,13013,12062,12063,12064,12065,12183,12068,12060,12061,12822,12996,12972,12989,10062,10063,10054,10055,10046,10047,10048,10049,10050,10051,10044,10045) AND `type` IN (0,11); INSERT INTO `achievement_criteria_data` (`criteria_id`,`type`,`value1`,`value2`,`ScriptName`) VALUES (3693,11,0,0, 'achievement_storm_glory'), (6641,11,0,0, 'achievement_school_of_hard_knocks'), @@ -1809,7 +1809,19 @@ INSERT INTO `achievement_criteria_data` (`criteria_id`,`type`,`value1`,`value2`, (12822,11,0,0, 'achievement_all_you_can_eat'), (12996,11,0,0, 'achievement_all_you_can_eat'), (12972,11,0,0, 'achievement_all_you_can_eat'), -(12989,11,0,0, 'achievement_all_you_can_eat'); +(12989,11,0,0, 'achievement_all_you_can_eat'), +(10044,11,0,0, 'achievement_unbroken'), +(10045,11,0,0, 'achievement_unbroken'), +(10054,11,0,0, 'achievement_shutout'), +(10055,11,0,0, 'achievement_shutout'), +(10046,11,0,0, 'achievement_three_car_garage_chopper'), +(10047,11,0,0, 'achievement_three_car_garage_siege'), +(10048,11,0,0, 'achievement_three_car_garage_demolisher'), +(10049,11,0,0, 'achievement_three_car_garage_chopper'), +(10050,11,0,0, 'achievement_three_car_garage_siege'), +(10051,11,0,0, 'achievement_three_car_garage_demolisher'), +(10062,11,0,0, 'achievement_quick_shave'), +(10063,11,0,0, 'achievement_quick_shave'); /* SPELLS */ INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES diff --git a/sql/updates/world/2011_03_26_0_world_achievement_criteria_data.sql b/sql/updates/world/2011_03_26_0_world_achievement_criteria_data.sql new file mode 100644 index 00000000000..ed92b7ea830 --- /dev/null +++ b/sql/updates/world/2011_03_26_0_world_achievement_criteria_data.sql @@ -0,0 +1,29 @@ +DELETE FROM `achievement_criteria_data` WHERE `criteria_id` IN (10062,10063,10054,10055,10046,10047,10048,10049,10050,10051,10044,10045); +INSERT INTO `achievement_criteria_data` (`criteria_id`,`type`,`value1`,`value2`,`ScriptName`) VALUES +(10062,12,0,0, 'achievement_quick_shave'), +(10063,12,1,0, 'achievement_quick_shave'), +(10044,12,0,0, 'achievement_unbroken'), +(10045,12,1,0, 'achievement_unbroken'), +(10054,12,0,0, 'achievement_shutout'), +(10055,12,1,0, 'achievement_shutout'), +(10046,12,0,0, 'achievement_three_car_garage_chopper'), +(10047,12,0,0, 'achievement_three_car_garage_siege'), +(10048,12,0,0, 'achievement_three_car_garage_demolisher'), +(10049,12,1,0, 'achievement_three_car_garage_chopper'), +(10050,12,1,0, 'achievement_three_car_garage_siege'), +(10051,12,1,0, 'achievement_three_car_garage_demolisher'), +(10062,11,0,0, 'achievement_quick_shave'), +(10063,11,0,0, 'achievement_quick_shave'), +(10044,11,0,0, 'achievement_unbroken'), +(10045,11,0,0, 'achievement_unbroken'), +(10054,11,0,0, 'achievement_shutout'), +(10055,11,0,0, 'achievement_shutout'), +(10046,11,0,0, 'achievement_three_car_garage_chopper'), +(10047,11,0,0, 'achievement_three_car_garage_siege'), +(10048,11,0,0, 'achievement_three_car_garage_demolisher'), +(10049,11,0,0, 'achievement_three_car_garage_chopper'), +(10050,11,0,0, 'achievement_three_car_garage_siege'), +(10051,11,0,0, 'achievement_three_car_garage_demolisher'); + +-- Remove disabled entries +DELETE FROM `disables` WHERE `sourceType`=4 AND `entry` IN (10044,10045,10046,10047,10048,10049,10050,10051,10054,10055,10062,10063); diff --git a/src/server/game/AI/CreatureAI.h b/src/server/game/AI/CreatureAI.h index fea04c6fd8d..e266ce14e80 100755 --- a/src/server/game/AI/CreatureAI.h +++ b/src/server/game/AI/CreatureAI.h @@ -73,9 +73,9 @@ class CreatureAI : public UnitAI void SetGazeOn(Unit* target); - Creature *DoSummon(uint32 uiEntry, const Position &pos, uint32 uiDespawntime = 30000, TempSummonType uiType = TEMPSUMMON_CORPSE_TIMED_DESPAWN); - Creature *DoSummon(uint32 uiEntry, WorldObject *obj, float fRadius = 5.0f, uint32 uiDespawntime = 30000, TempSummonType uiType = TEMPSUMMON_CORPSE_TIMED_DESPAWN); - Creature *DoSummonFlyer(uint32 uiEntry, WorldObject *obj, float fZ, float fRadius = 5.0f, uint32 uiDespawntime = 30000, TempSummonType uiType = TEMPSUMMON_CORPSE_TIMED_DESPAWN); + Creature* DoSummon(uint32 entry, Position const& pos, uint32 despawnTime = 30000, TempSummonType summonType = TEMPSUMMON_CORPSE_TIMED_DESPAWN); + Creature* DoSummon(uint32 entry, WorldObject *obj, float radius = 5.0f, uint32 despawnTime = 30000, TempSummonType summonType = TEMPSUMMON_CORPSE_TIMED_DESPAWN); + Creature* DoSummonFlyer(uint32 entry, WorldObject *obj, float flightZ, float radius = 5.0f, uint32 despawnTime = 30000, TempSummonType summonType = TEMPSUMMON_CORPSE_TIMED_DESPAWN); public: void Talk(uint8 id, uint64 WhisperGuid = 0); diff --git a/src/server/game/AI/CreatureAIImpl.h b/src/server/game/AI/CreatureAIImpl.h index f92fb316377..4619c6f9f79 100755 --- a/src/server/game/AI/CreatureAIImpl.h +++ b/src/server/game/AI/CreatureAIImpl.h @@ -584,24 +584,24 @@ inline void UnitAI::DoCastAOE(uint32 spellId, bool triggered) me->CastSpell((Unit*)NULL, spellId, triggered); } -inline Creature *CreatureAI::DoSummon(uint32 uiEntry, const Position &pos, uint32 uiDespawntime, TempSummonType uiType) +inline Creature* CreatureAI::DoSummon(uint32 entry, const Position &pos, uint32 despawnTime, TempSummonType summonType) { - return me->SummonCreature(uiEntry, pos, uiType, uiDespawntime); + return me->SummonCreature(entry, pos, summonType, despawnTime); } -inline Creature *CreatureAI::DoSummon(uint32 uiEntry, WorldObject* obj, float fRadius, uint32 uiDespawntime, TempSummonType uiType) +inline Creature* CreatureAI::DoSummon(uint32 entry, WorldObject* obj, float radius, uint32 despawnTime, TempSummonType summonType) { Position pos; - obj->GetRandomNearPosition(pos, fRadius); - return me->SummonCreature(uiEntry, pos, uiType, uiDespawntime); + obj->GetRandomNearPosition(pos, radius); + return me->SummonCreature(entry, pos, summonType, despawnTime); } -inline Creature *CreatureAI::DoSummonFlyer(uint32 uiEntry, WorldObject *obj, float _fZ, float fRadius, uint32 uiDespawntime, TempSummonType uiType) +inline Creature* CreatureAI::DoSummonFlyer(uint32 entry, WorldObject* obj, float flightZ, float radius, uint32 despawnTime, TempSummonType summonType) { Position pos; - obj->GetRandomNearPosition(pos, fRadius); - pos.m_positionZ += _fZ; - return me->SummonCreature(uiEntry, pos, uiType, uiDespawntime); + obj->GetRandomNearPosition(pos, radius); + pos.m_positionZ += flightZ; + return me->SummonCreature(entry, pos, summonType, despawnTime); } #endif diff --git a/src/server/scripts/Northrend/Ulduar/ulduar/boss_flame_leviathan.cpp b/src/server/scripts/Northrend/Ulduar/ulduar/boss_flame_leviathan.cpp index 5293af733a1..06162b8feb6 100644 --- a/src/server/scripts/Northrend/Ulduar/ulduar/boss_flame_leviathan.cpp +++ b/src/server/scripts/Northrend/Ulduar/ulduar/boss_flame_leviathan.cpp @@ -71,13 +71,14 @@ enum Spells enum Creatures { - MOB_MECHANOLIFT = 33214, - MOB_LIQUID = 33189, - MOB_CONTAINER = 33218, - MOB_THORIM_BEACON = 33365, - MOB_MIMIRON_BEACON = 33370, - MOB_HODIR_BEACON = 33212, - MOB_FREYA_BEACON = 33367, + NPC_SEAT = 33114, + NPC_MECHANOLIFT = 33214, + NPC_LIQUID = 33189, + NPC_CONTAINER = 33218, + NPC_THORIM_BEACON = 33365, + NPC_MIMIRON_BEACON = 33370, + NPC_HODIR_BEACON = 33212, + NPC_FREYA_BEACON = 33367, NPC_THORIM_TARGET_BEACON = 33364, NPC_MIMIRON_TARGET_BEACON = 33369, NPC_HODIR_TARGET_BEACON = 33108, @@ -90,26 +91,25 @@ enum Creatures enum Towers { - GO_TOWER_OF_STORMS = 194377, - GO_TOWER_OF_FLAMES = 194371, - GO_TOWER_OF_FROST = 194370, - GO_TOWER_OF_LIFE = 194375, + GO_TOWER_OF_STORMS = 194377, + GO_TOWER_OF_FLAMES = 194371, + GO_TOWER_OF_FROST = 194370, + GO_TOWER_OF_LIFE = 194375, }; enum Events { - EVENT_NONE, - EVENT_PURSUE, - EVENT_MISSILE, - EVENT_VENT, - EVENT_SPEED, - EVENT_SUMMON, - EVENT_SHUTDOWN, - EVENT_REPAIR, - EVENT_THORIM_S_HAMMER, // Tower of Storms - EVENT_MIMIRON_S_INFERNO, // Tower of Flames - EVENT_HODIR_S_FURY, // Tower of Frost - EVENT_FREYA_S_WARD, // Tower of Nature + EVENT_PURSUE = 1, + EVENT_MISSILE = 2, + EVENT_VENT = 3, + EVENT_SPEED = 4, + EVENT_SUMMON = 5, + EVENT_SHUTDOWN = 6, + EVENT_REPAIR = 7, + EVENT_THORIM_S_HAMMER = 8, // Tower of Storms + EVENT_MIMIRON_S_INFERNO = 9, // Tower of Flames + EVENT_HODIR_S_FURY = 10, // Tower of Frost + EVENT_FREYA_S_WARD = 11, // Tower of Nature }; enum Seats @@ -130,6 +130,8 @@ enum Vehicles #define EMOTE_PURSUE "Flame Leviathan pursues $N." #define EMOTE_OVERLOAD "Flame Leviathan's circuits overloaded." #define EMOTE_REPAIR "Automatic repair sequence initiated." +#define DATA_SHUTOUT 29112912 // 2911, 2912 are achievement IDs +#define DATA_UNBROKEN 29052906 // 2905, 2906 are achievement IDs enum Yells { @@ -151,7 +153,7 @@ enum Yells SAY_OVERLOAD_3 = -1603075, }; -enum eAchievementData +enum AchievementData { ACHIEV_10_NUKED_FROM_ORBIT = 2915, ACHIEV_25_NUKED_FROM_ORBIT = 2917, @@ -161,22 +163,24 @@ enum eAchievementData ACHIEV_25_ORBITAL_DEVASTATION = 2916, ACHIEV_10_ORBIT_UARY = 3056, ACHIEV_25_ORBIT_UARY = 3057, - ACHIEV_10_SHUTOUT = 2911, - ACHIEV_25_SHUTOUT = 2912, ACHIEV_10_SIEGE_OF_ULDUAR = 2886, ACHIEV_25_SIEGE_OF_ULDUAR = 2887, - ACHIEV_10_THREE_CAR_GARAGE = 2907, //no core support for using a vehicle - ACHIEV_25_THREE_CAR_GARAGE = 2908, //no core support for using a vehicle - ACHIEV_10_UNBROKEN = 2905, - ACHIEV_25_UNBROKEN = 2906, }; -static Position Center[]= +enum actions +{ + ACTION_TOWER_OF_STORM_DESTROYED = 1, + ACTION_TOWER_OF_FROST_DESTROYED = 2, + ACTION_TOWER_OF_FLAMES_DESTROYED = 3, + ACTION_TOWER_OF_LIFE_DESTROYED = 4, +}; + +Position const Center[]= { {354.8771f, -12.90240f, 409.803650f, 0.0f}, }; -const Position PosSiege[5] = +Position const PosSiege[5] = { {-814.59f,-64.54f,429.92f,5.969f}, {-784.37f,-33.31f,429.92f,5.096f}, @@ -185,7 +189,7 @@ const Position PosSiege[5] = {-812.83f,-77.71f,429.92f,0.046f}, }; -const Position PosChopper[5] = +Position const PosChopper[5] = { {-717.83f,-106.56f,430.02f,0.122f}, {-717.83f,-114.23f,430.44f,0.122f}, @@ -194,7 +198,7 @@ const Position PosChopper[5] = {-718.45f,-123.58f,430.41f,0.085f}, }; -const Position PosDemolisher[5] = +Position const PosDemolisher[5] = { {-724.12f,-176.64f,430.03f,2.543f}, {-766.70f,-225.03f,430.50f,1.710f}, @@ -205,77 +209,74 @@ const Position PosDemolisher[5] = class boss_flame_leviathan : public CreatureScript { -public: - boss_flame_leviathan() : CreatureScript("boss_flame_leviathan") { } + public: + boss_flame_leviathan() : CreatureScript("boss_flame_leviathan") { } - CreatureAI* GetAI(Creature* pCreature) const - { - return new boss_flame_leviathanAI (pCreature); - } - - struct boss_flame_leviathanAI : public BossAI - { - boss_flame_leviathanAI(Creature* pCreature) : BossAI(pCreature, TYPE_LEVIATHAN), vehicle(pCreature->GetVehicleKit()) + struct boss_flame_leviathanAI : public BossAI { - } + boss_flame_leviathanAI(Creature* creature) : BossAI(creature, TYPE_LEVIATHAN), vehicle(creature->GetVehicleKit()) + { + } - void InitializeAI() - { - assert(vehicle); - Reset(); - uiActiveTowers = 4; - uiShutdown = 0; - ActiveTowers = false; - towerOfStorms = false; - towerOfLife = false; - towerOfFlames = false; - towerOfFrost = false; - - // need to have correct immunities set in db - me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_KNOCK_BACK, true); - me->ApplySpellImmune(0, IMMUNITY_ID, 49560, true); //deathgrip - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_STUNNED); - me->SetReactState(REACT_PASSIVE); - } + void InitializeAI() + { + ASSERT(vehicle); + Reset(); + ActiveTowersCount = 4; + Shutdown = 0; + ActiveTowers = false; + towerOfStorms = false; + towerOfLife = false; + towerOfFlames = false; + towerOfFrost = false; + Shutout = true; + Unbroken = true; - Vehicle* vehicle; - uint8 uiActiveTowers; - uint8 uiShutdown; - bool ActiveTowers; - bool towerOfStorms; - bool towerOfLife; - bool towerOfFlames; - bool towerOfFrost; + // need to have correct immunities set in db + me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_KNOCK_BACK, true); + me->ApplySpellImmune(0, IMMUNITY_ID, 49560, true); //deathgrip + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_STUNNED); + me->SetReactState(REACT_PASSIVE); + } - void Reset() - { - _Reset(); - uiShutdown = 0; - me->SetReactState(REACT_DEFENSIVE); - if (me->GetVehicleKit()) + Vehicle* vehicle; + uint8 ActiveTowersCount; + uint8 Shutdown; + bool ActiveTowers; + bool towerOfStorms; + bool towerOfLife; + bool towerOfFlames; + bool towerOfFrost; + bool Shutout; + bool Unbroken; + + void Reset() { - me->GetVehicleKit()->Reset(); - if (me->GetVehicleKit()->GetPassenger(7)) - me->CastSpell(me->GetVehicleKit()->GetPassenger(SEAT_CANNON),AURA_STEALTH_DETECTION,false); + _Reset(); + Shutdown = 0; + me->SetReactState(REACT_DEFENSIVE); + if (me->GetVehicleKit()) + { + me->GetVehicleKit()->Reset(); + if (me->GetVehicleKit()->GetPassenger(SEAT_CANNON)) + me->CastSpell(me->GetVehicleKit()->GetPassenger(SEAT_CANNON),AURA_STEALTH_DETECTION,false); + } } - } - void EnterCombat(Unit* /*who*/) - { - _EnterCombat(); - me->SetReactState(REACT_AGGRESSIVE); - events.ScheduleEvent(EVENT_PURSUE, 30*IN_MILLISECONDS); - events.ScheduleEvent(EVENT_MISSILE, urand(1500, 4*IN_MILLISECONDS)); - events.ScheduleEvent(EVENT_VENT, 20*IN_MILLISECONDS); - events.ScheduleEvent(EVENT_SHUTDOWN, 150*IN_MILLISECONDS); - events.ScheduleEvent(EVENT_SPEED, 15*IN_MILLISECONDS); - events.ScheduleEvent(EVENT_SUMMON, 1*IN_MILLISECONDS); - ActiveTower(false); //void ActiveTower - } + void EnterCombat(Unit* /*who*/) + { + _EnterCombat(); + me->SetReactState(REACT_AGGRESSIVE); + events.ScheduleEvent(EVENT_PURSUE, 30*IN_MILLISECONDS); + events.ScheduleEvent(EVENT_MISSILE, urand(1500, 4*IN_MILLISECONDS)); + events.ScheduleEvent(EVENT_VENT, 20*IN_MILLISECONDS); + events.ScheduleEvent(EVENT_SHUTDOWN, 150*IN_MILLISECONDS); + events.ScheduleEvent(EVENT_SPEED, 15*IN_MILLISECONDS); + events.ScheduleEvent(EVENT_SUMMON, 1*IN_MILLISECONDS); + ActiveTower(); //void ActiveTower + } - void ActiveTower(bool bReset = false) - { - if (!bReset) + void ActiveTower() { if (ActiveTowers) { @@ -311,638 +312,650 @@ public: else DoScriptText(SAY_AGGRO, me); } - } - // TODO: effect 0 and effect 1 may be on different target - void SpellHitTarget(Unit* pTarget, const SpellEntry* pSpell) - { - if (pSpell->Id == SPELL_PURSUED) - AttackStart(pTarget); - } - - void JustDied(Unit* /*victim*/) - { - _JustDied(); - DoScriptText(SAY_DEATH, me); + // TODO: effect 0 and effect 1 may be on different target + void SpellHitTarget(Unit* target, SpellEntry* const spell) + { + if (spell->Id == SPELL_PURSUED) + AttackStart(target); + } - if (ActiveTowers) + void JustDied(Unit* /*victim*/) { - switch (uiActiveTowers) + _JustDied(); + DoScriptText(SAY_DEATH, me); + + if (ActiveTowers) { - case 4: - instance->DoCompleteAchievement(RAID_MODE(ACHIEV_10_ORBIT_UARY, ACHIEV_25_ORBIT_UARY)); - case 3: - instance->DoCompleteAchievement(RAID_MODE(ACHIEV_10_NUKED_FROM_ORBIT, ACHIEV_25_NUKED_FROM_ORBIT)); - case 2: - instance->DoCompleteAchievement(RAID_MODE(ACHIEV_10_ORBITAL_DEVASTATION, ACHIEV_25_ORBITAL_DEVASTATION)); - case 1: - instance->DoCompleteAchievement(RAID_MODE(ACHIEV_10_ORBITAL_BOMBARDMENT, ACHIEV_25_ORBITAL_BOMBARDMENT)); + switch (ActiveTowersCount) + { + case 4: + instance->DoCompleteAchievement(RAID_MODE(ACHIEV_10_ORBIT_UARY, ACHIEV_25_ORBIT_UARY)); + case 3: + instance->DoCompleteAchievement(RAID_MODE(ACHIEV_10_NUKED_FROM_ORBIT, ACHIEV_25_NUKED_FROM_ORBIT)); + case 2: + instance->DoCompleteAchievement(RAID_MODE(ACHIEV_10_ORBITAL_DEVASTATION, ACHIEV_25_ORBITAL_DEVASTATION)); + case 1: + instance->DoCompleteAchievement(RAID_MODE(ACHIEV_10_ORBITAL_BOMBARDMENT, ACHIEV_25_ORBITAL_BOMBARDMENT)); + } } } - } - void SpellHit(Unit* /*caster*/, const SpellEntry* pSpell) - { - if (pSpell->Id == SPELL_START_THE_ENGINE) - vehicle->InstallAllAccessories(); - - if (pSpell->Id == SPELL_ELECTROSHOCK) - me->InterruptSpell(CURRENT_CHANNELED_SPELL); - - if (pSpell->Id == SPELL_OVERLOAD_CIRCUIT) - uiShutdown++; - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim() || !CheckInRoom()) - return; + void SpellHit(Unit* /*caster*/, SpellEntry* const spell) + { + if (spell->Id == SPELL_START_THE_ENGINE) + vehicle->InstallAllAccessories(); - events.Update(diff); + if (spell->Id == SPELL_ELECTROSHOCK) + me->InterruptSpell(CURRENT_CHANNELED_SPELL); - if (uiShutdown == RAID_MODE(2,4)) - { - uiShutdown = 0; - events.ScheduleEvent(EVENT_SHUTDOWN, 4000); - me->RemoveAurasDueToSpell(SPELL_OVERLOAD_CIRCUIT); - me->InterruptNonMeleeSpells(true); - return; + if (spell->Id == SPELL_OVERLOAD_CIRCUIT) + ++Shutdown; } - if (me->HasAura(SPELL_SYSTEMS_SHUTDOWN)) + uint32 GetData(uint32 type) { - me->SetReactState(REACT_PASSIVE); - me->AddUnitState(UNIT_STAT_STUNNED | UNIT_STAT_ROOT); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED); - return; + switch (type) + { + case DATA_SHUTOUT: + return Shutout ? 1 : 0; + case DATA_UNBROKEN: + return Unbroken ? 1 : 0; + default: + break; + } + + return 0; } - else + + void SetData(uint32 id, uint32 data) { - me->SetReactState(REACT_AGGRESSIVE); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED); + if (id == DATA_UNBROKEN) + Unbroken = data ? true : false; } - if (me->HasUnitState(UNIT_STAT_CASTING)) - return; + void UpdateAI(uint32 const diff) + { + if (!UpdateVictim() || !CheckInRoom()) + return; - uint32 eventId = events.GetEvent(); + events.Update(diff); - switch(eventId) - { - case 0: break; // this is a must - case EVENT_PURSUE: - DoScriptText(RAND(SAY_TARGET_1, SAY_TARGET_2, SAY_TARGET_3), me); - if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM,0,75,true)) + if (Shutdown == RAID_MODE(2,4)) { - me->AddAura(SPELL_PURSUED, pTarget); - me->MonsterTextEmote(EMOTE_PURSUE, pTarget->GetGUID(), true); + Shutdown = 0; + events.ScheduleEvent(EVENT_SHUTDOWN, 4000); + me->RemoveAurasDueToSpell(SPELL_OVERLOAD_CIRCUIT); + me->InterruptNonMeleeSpells(true); + return; } - events.RepeatEvent(30*IN_MILLISECONDS); - break; - case EVENT_MISSILE: - if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM)) - DoCast(pTarget, SPELL_MISSILE_BARRAGE); - events.RepeatEvent(1500); - break; - case EVENT_VENT: - DoCastAOE(SPELL_FLAME_VENTS); - events.RepeatEvent(20*IN_MILLISECONDS); - break; - case EVENT_SPEED: - DoCastAOE(SPELL_GATHERING_SPEED); - events.RepeatEvent(15*IN_MILLISECONDS); - break; - case EVENT_SUMMON: - if (summons.size() < 15) - if (Creature* pLift = DoSummonFlyer(MOB_MECHANOLIFT, me, 30.0f, 50.0f, 0)) - pLift->GetMotionMaster()->MoveRandom(100); - events.RepeatEvent(2*IN_MILLISECONDS); - break; - case EVENT_SHUTDOWN: - DoScriptText(RAND(SAY_OVERLOAD_1, SAY_OVERLOAD_2, SAY_OVERLOAD_3), me); - me->MonsterTextEmote(EMOTE_OVERLOAD, 0, true); - me->AddAura(SPELL_SYSTEMS_SHUTDOWN, me); - me->RemoveAurasDueToSpell(SPELL_GATHERING_SPEED); - events.ScheduleEvent(EVENT_REPAIR, 4000); - events.CancelEvent(EVENT_SHUTDOWN); - break; - case EVENT_REPAIR: - me->MonsterTextEmote(EMOTE_REPAIR, 0, true); - me->ClearUnitState(UNIT_STAT_STUNNED | UNIT_STAT_ROOT); - events.ScheduleEvent(EVENT_SHUTDOWN, 150*IN_MILLISECONDS); - events.CancelEvent(EVENT_REPAIR); - break; - case EVENT_THORIM_S_HAMMER: // Tower of Storms - for (uint8 i = 0; i < 7; ++i) + + if (me->HasAura(SPELL_SYSTEMS_SHUTDOWN)) { - if (Creature* pThorim = DoSummon(MOB_THORIM_BEACON, me, float(urand(20,60)), 20000, TEMPSUMMON_TIMED_DESPAWN)) - pThorim->GetMotionMaster()->MoveRandom(100); + me->SetReactState(REACT_PASSIVE); + me->AddUnitState(UNIT_STAT_STUNNED | UNIT_STAT_ROOT); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED); + if (Shutout) + Shutout = false; + return; } - DoScriptText(SAY_TOWER_STORM, me); - events.CancelEvent(EVENT_THORIM_S_HAMMER); - break; - case EVENT_MIMIRON_S_INFERNO: // Tower of Flames - me->SummonCreature(MOB_MIMIRON_BEACON, 390.93f, -13.91f, 409.81f); - DoScriptText(SAY_TOWER_FLAME, me); - events.CancelEvent(EVENT_MIMIRON_S_INFERNO); - break; - case EVENT_HODIR_S_FURY: // Tower of Frost - for (uint8 i = 0; i < 7; ++i) + else { - if (Creature* pHodir = DoSummon(MOB_HODIR_BEACON, me, 50, 0)) - pHodir->GetMotionMaster()->MoveRandom(100); + me->SetReactState(REACT_AGGRESSIVE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED); } - DoScriptText(SAY_TOWER_FROST, me); - events.CancelEvent(EVENT_HODIR_S_FURY); - break; - case EVENT_FREYA_S_WARD: // Tower of Nature - DoScriptText(SAY_TOWER_NATURE, me); - StartFreyaEvent(); - if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM)) - DoCast(pTarget, SPELL_FREYA_S_WARD); - events.CancelEvent(EVENT_FREYA_S_WARD); - break; - default: - events.PopEvent(); - break; - } - /*if (me->IsWithinMeleeRange(me->getVictim())) //bugged spell casts on units that are boarded on leviathan - DoSpellAttackIfReady(SPELL_BATTERING_RAM);*/ - DoMeleeAttackIfReady(); - } - void StartFreyaEvent()//summon these 4 on each corner wich wil spawn additional hostile mobs - { - me->SummonCreature(MOB_FREYA_BEACON, 377.02f, -119.10f, 409.81f); - me->SummonCreature(MOB_FREYA_BEACON, 377.02f, 54.78f, 409.81f); - me->SummonCreature(MOB_FREYA_BEACON, 185.62f, 54.78f, 409.81f); - me->SummonCreature(MOB_FREYA_BEACON, 185.62f, -119.10f, 409.81f); - } + if (me->HasUnitState(UNIT_STAT_CASTING)) + return; - void DoAction(const int32 uiAction) - { - // Start encounter - if (uiAction == 10) - { - if (!me->isDead()) + uint32 eventId = events.GetEvent(); + + switch(eventId) { - me->SetHomePosition(354.8771f, -12.90240f, 409.803f, 0); - me->GetMotionMaster()->MoveCharge(354.8771f, -12.90240f, 409.803f); //position center - me->SetReactState(REACT_AGGRESSIVE); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_STUNNED); - return; + case 0: + break; // this is a must + case EVENT_PURSUE: + DoScriptText(RAND(SAY_TARGET_1, SAY_TARGET_2, SAY_TARGET_3), me); + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM,0,75,true)) + { + me->AddAura(SPELL_PURSUED, target); + me->MonsterTextEmote(EMOTE_PURSUE, target->GetGUID(), true); + } + events.RepeatEvent(30*IN_MILLISECONDS); + break; + case EVENT_MISSILE: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM)) + DoCast(target, SPELL_MISSILE_BARRAGE); + events.RepeatEvent(1500); + break; + case EVENT_VENT: + DoCastAOE(SPELL_FLAME_VENTS); + events.RepeatEvent(20*IN_MILLISECONDS); + break; + case EVENT_SPEED: + DoCastAOE(SPELL_GATHERING_SPEED); + events.RepeatEvent(15*IN_MILLISECONDS); + break; + case EVENT_SUMMON: + if (summons.size() < 15) + if (Creature* lift = DoSummonFlyer(NPC_MECHANOLIFT, me, 30.0f, 50.0f, 0)) + lift->GetMotionMaster()->MoveRandom(100); + events.RepeatEvent(2*IN_MILLISECONDS); + break; + case EVENT_SHUTDOWN: + DoScriptText(RAND(SAY_OVERLOAD_1, SAY_OVERLOAD_2, SAY_OVERLOAD_3), me); + me->MonsterTextEmote(EMOTE_OVERLOAD, 0, true); + me->AddAura(SPELL_SYSTEMS_SHUTDOWN, me); + me->RemoveAurasDueToSpell(SPELL_GATHERING_SPEED); + events.ScheduleEvent(EVENT_REPAIR, 4000); + events.CancelEvent(EVENT_SHUTDOWN); + break; + case EVENT_REPAIR: + me->MonsterTextEmote(EMOTE_REPAIR, 0, true); + me->ClearUnitState(UNIT_STAT_STUNNED | UNIT_STAT_ROOT); + events.ScheduleEvent(EVENT_SHUTDOWN, 150*IN_MILLISECONDS); + events.CancelEvent(EVENT_REPAIR); + break; + case EVENT_THORIM_S_HAMMER: // Tower of Storms + for (uint8 i = 0; i < 7; ++i) + { + if (Creature* thorim = DoSummon(NPC_THORIM_BEACON, me, float(urand(20,60)), 20000, TEMPSUMMON_TIMED_DESPAWN)) + thorim->GetMotionMaster()->MoveRandom(100); + } + DoScriptText(SAY_TOWER_STORM, me); + events.CancelEvent(EVENT_THORIM_S_HAMMER); + break; + case EVENT_MIMIRON_S_INFERNO: // Tower of Flames + me->SummonCreature(NPC_MIMIRON_BEACON, 390.93f, -13.91f, 409.81f); + DoScriptText(SAY_TOWER_FLAME, me); + events.CancelEvent(EVENT_MIMIRON_S_INFERNO); + break; + case EVENT_HODIR_S_FURY: // Tower of Frost + for (uint8 i = 0; i < 7; ++i) + { + if (Creature* hodir = DoSummon(NPC_HODIR_BEACON, me, 50, 0)) + hodir->GetMotionMaster()->MoveRandom(100); + } + DoScriptText(SAY_TOWER_FROST, me); + events.CancelEvent(EVENT_HODIR_S_FURY); + break; + case EVENT_FREYA_S_WARD: // Tower of Nature + DoScriptText(SAY_TOWER_NATURE, me); + StartFreyaEvent(); + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM)) + DoCast(target, SPELL_FREYA_S_WARD); + events.CancelEvent(EVENT_FREYA_S_WARD); + break; + default: + events.PopEvent(); + break; } + /*if (me->IsWithinMeleeRange(me->getVictim())) //bugged spell casts on units that are boarded on leviathan + DoSpellAttackIfReady(SPELL_BATTERING_RAM);*/ + DoMeleeAttackIfReady(); } - if (uiAction && uiAction <= 4) // Tower destruction, debuff leviathan loot and reduce active tower + void StartFreyaEvent()//summon these 4 on each corner wich wil spawn additional hostile mobs { - if (me->HasLootMode(31) && uiActiveTowers == 4) - { - me->RemoveLootMode(LOOT_MODE_HARD_MODE_4); - --uiActiveTowers; - } - if (me->HasLootMode(15) && uiActiveTowers == 3) + me->SummonCreature(NPC_FREYA_BEACON, 377.02f, -119.10f, 409.81f); + me->SummonCreature(NPC_FREYA_BEACON, 377.02f, 54.78f, 409.81f); + me->SummonCreature(NPC_FREYA_BEACON, 185.62f, 54.78f, 409.81f); + me->SummonCreature(NPC_FREYA_BEACON, 185.62f, -119.10f, 409.81f); + } + + void DoAction(int32 const action) + { + // Start encounter + if (action == 10) { - me->RemoveLootMode(LOOT_MODE_HARD_MODE_3); - --uiActiveTowers; + if (!me->isDead()) + { + me->SetHomePosition(Center->GetPositionX(), Center->GetPositionY(), Center->GetPositionZ(), 0); + me->GetMotionMaster()->MoveCharge(Center->GetPositionX(), Center->GetPositionY(), Center->GetPositionZ()); //position center + me->SetReactState(REACT_AGGRESSIVE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_STUNNED); + return; + } } - if (me->HasLootMode(7) && uiActiveTowers == 2) + + if (action && action <= 4) // Tower destruction, debuff leviathan loot and reduce active tower { - me->RemoveLootMode(LOOT_MODE_HARD_MODE_2); - --uiActiveTowers; + if (me->HasLootMode(31) && ActiveTowersCount == 4) + { + me->RemoveLootMode(LOOT_MODE_HARD_MODE_4); + --ActiveTowersCount; + } + if (me->HasLootMode(15) && ActiveTowersCount == 3) + { + me->RemoveLootMode(LOOT_MODE_HARD_MODE_3); + --ActiveTowersCount; + } + if (me->HasLootMode(7) && ActiveTowersCount == 2) + { + me->RemoveLootMode(LOOT_MODE_HARD_MODE_2); + --ActiveTowersCount; + } + if (me->HasLootMode(3) && ActiveTowersCount == 1) + { + me->RemoveLootMode(LOOT_MODE_HARD_MODE_1); + --ActiveTowersCount; + } } - if (me->HasLootMode(3) && uiActiveTowers == 1) + + switch (action) { - me->RemoveLootMode(LOOT_MODE_HARD_MODE_1); - --uiActiveTowers; + case 0: // Activate hard-mode setting counter to 4 towers, enable all towers apply buffs on levithian + ActiveTowers = true; + towerOfStorms = true; + towerOfLife = true; + towerOfFlames = true; + towerOfFrost = true; + me->SetLootMode(31); + break; + case ACTION_TOWER_OF_STORM_DESTROYED: // Tower of Storms destroyed + towerOfStorms = false; + break; + case ACTION_TOWER_OF_FROST_DESTROYED: // Tower of Frost destroyed + towerOfFrost = false; + break; + case ACTION_TOWER_OF_FLAMES_DESTROYED: // Tower of Flames destroyed + towerOfFlames = false; + break; + case ACTION_TOWER_OF_LIFE_DESTROYED: // Tower of Nature destroyed + towerOfLife = false; + break; + default: + break; } } + }; - switch (uiAction) - { - case 0: // Activate hard-mode setting counter to 4 towers, enable all towers apply buffs on levithian - ActiveTowers = true; - towerOfStorms = true; - towerOfLife = true; - towerOfFlames = true; - towerOfFrost = true; - me->SetLootMode(31); - break; - case 1: // Tower of Storms destroyed - towerOfStorms = false; - break; - case 2: // Tower of Flames destroyed - towerOfFlames = false; - break; - case 3: // Tower of Frost destroyed - towerOfFrost = false; - break; - case 4: // Tower of Nature destroyed - towerOfLife = false; - break; - } + CreatureAI* GetAI(Creature* creature) const + { + return new boss_flame_leviathanAI(creature); } - }; - }; -//#define BOSS_DEBUG - class boss_flame_leviathan_seat : public CreatureScript { -public: - boss_flame_leviathan_seat() : CreatureScript("boss_flame_leviathan_seat") { } + public: + boss_flame_leviathan_seat() : CreatureScript("boss_flame_leviathan_seat") { } - CreatureAI* GetAI(Creature* pCreature) const - { - return new boss_flame_leviathan_seatAI (pCreature); - } - - struct boss_flame_leviathan_seatAI : public ScriptedAI - { - boss_flame_leviathan_seatAI(Creature* pCreature) : ScriptedAI(pCreature), vehicle(pCreature->GetVehicleKit()) + struct boss_flame_leviathan_seatAI : public ScriptedAI { - assert(vehicle); - me->SetReactState(REACT_PASSIVE); - me->SetDisplayId(24914); - instance = pCreature->GetInstanceScript(); - } - - InstanceScript* instance; - Vehicle* vehicle; + boss_flame_leviathan_seatAI(Creature* creature) : ScriptedAI(creature), vehicle(creature->GetVehicleKit()) + { + ASSERT(vehicle); + me->SetReactState(REACT_PASSIVE); + me->SetDisplayId(me->GetCreatureInfo()->Modelid2); + instance = creature->GetInstanceScript(); + } - void Reset() - { - if (me->GetVehicleKit()) - me->GetVehicleKit()->Reset(); - } + InstanceScript* instance; + Vehicle* vehicle; - void PassengerBoarded(Unit* who, int8 seatId, bool apply) - { - if (!me->GetVehicle()) - return; + void Reset() + { + if (me->GetVehicleKit()) + me->GetVehicleKit()->Reset(); + } - if (seatId == SEAT_PLAYER) + void PassengerBoarded(Unit* who, int8 seatId, bool apply) { - if (!apply) + if (!me->GetVehicle()) return; - else - DoScriptText(SAY_PLAYER_RIDING,me); - - if (Creature* pTurret = me->GetVehicleKit()->GetPassenger(1)->ToCreature()) - { - pTurret->setFaction(me->GetVehicleBase()->getFaction()); - pTurret->SetUInt32Value(UNIT_FIELD_FLAGS, 0); // unselectable - pTurret->AI()->AttackStart(who); - } - if (Creature* pDevice = me->GetVehicleKit()->GetPassenger(2)->ToCreature()) - { - pDevice->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK); - pDevice->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - } - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + + if (seatId == SEAT_PLAYER) + { + if (!apply) + return; + else + DoScriptText(SAY_PLAYER_RIDING, me); + + if (Creature* turret = me->GetVehicleKit()->GetPassenger(SEAT_TURRET)->ToCreature()) + { + turret->setFaction(me->GetVehicleBase()->getFaction()); + turret->SetUInt32Value(UNIT_FIELD_FLAGS, 0); // unselectable + turret->AI()->AttackStart(who); + } + if (Creature* device = me->GetVehicleKit()->GetPassenger(SEAT_DEVICE)->ToCreature()) + { + device->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK); + device->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + } + + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + } + else if (seatId == SEAT_TURRET) + { + if (apply) + return; + + if (Unit* device = vehicle->GetPassenger(SEAT_DEVICE)) + { + device->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK); + device->SetUInt32Value(UNIT_FIELD_FLAGS, 0); // unselectable + } + } } - //else - // if (seatId == SEAT_TURRET) - // { - // if (apply) - // return; - // if (Unit* device = vehicle->GetPassenger(SEAT_DEVICE)) - // { - // device->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK); - // device->SetUInt32Value(UNIT_FIELD_FLAGS, 0); // unselectable - // } - // } + }; + + CreatureAI* GetAI(Creature* creature) const + { + return new boss_flame_leviathan_seatAI(creature); } - }; }; class boss_flame_leviathan_defense_cannon : public CreatureScript { -public: - boss_flame_leviathan_defense_cannon() : CreatureScript("boss_flame_leviathan_defense_cannon") { } + public: + boss_flame_leviathan_defense_cannon() : CreatureScript("boss_flame_leviathan_defense_cannon") { } - CreatureAI* GetAI(Creature* pCreature) const - { - return new boss_flame_leviathan_defense_cannonAI (pCreature); - } + struct boss_flame_leviathan_defense_cannonAI : public ScriptedAI + { + boss_flame_leviathan_defense_cannonAI(Creature* creature) : ScriptedAI(creature) + { + } - struct boss_flame_leviathan_defense_cannonAI : public ScriptedAI - { - boss_flame_leviathan_defense_cannonAI(Creature* pCreature) : ScriptedAI(pCreature) { } + uint32 NapalmTimer; - uint32 NapalmTimer; + void Reset () + { + NapalmTimer = 5000; + } - void Reset () - { - NapalmTimer = 5000; - } + void UpdateAI(uint32 const diff) + { + if (!UpdateVictim()) + return; - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + if (NapalmTimer <= diff) + { + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM,0)) + if(CanAIAttack(target)) + DoCast(target, SPELL_NAPALM, true); - if (NapalmTimer <= diff) - { - if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM,0)) - { - if(CanAIAttack(pTarget)) - DoCast(pTarget,SPELL_NAPALM,true); - } NapalmTimer = 5000; + } + else + NapalmTimer -= diff; } - else - NapalmTimer-=diff; - } - bool CanAIAttack(const Unit *who) const + bool CanAIAttack(Unit* const who) const + { + if (who->GetTypeId() != TYPEID_PLAYER || !who->GetVehicle() || who->GetVehicleBase()->GetEntry() == NPC_SEAT) + return false; + return true; + } + }; + + CreatureAI* GetAI(Creature* creature) const { - if (who->GetTypeId() != TYPEID_PLAYER || !who->GetVehicle() || who->GetVehicleBase()->GetEntry() != 33114) - return false; - return true; + return new boss_flame_leviathan_defense_cannonAI(creature); } - }; }; class boss_flame_leviathan_defense_turret : public CreatureScript { -public: - boss_flame_leviathan_defense_turret() : CreatureScript("boss_flame_leviathan_defense_turret") { } + public: + boss_flame_leviathan_defense_turret() : CreatureScript("boss_flame_leviathan_defense_turret") { } - CreatureAI* GetAI(Creature* pCreature) const - { - return new boss_flame_leviathan_defense_turretAI (pCreature); - } + struct boss_flame_leviathan_defense_turretAI : public TurretAI + { + boss_flame_leviathan_defense_turretAI(Creature* creature) : TurretAI(creature) {} - struct boss_flame_leviathan_defense_turretAI : public TurretAI - { - boss_flame_leviathan_defense_turretAI(Creature *c) : TurretAI(c) {} + void DamageTaken(Unit* who, uint32 &damage) + { + if (!CanAIAttack(who)) + damage = 0; + } - void DamageTaken(Unit* who, uint32 &damage) - { - if (!CanAIAttack(who)) - damage = 0; - } + bool CanAIAttack(Unit* const who) const + { + if (who->GetTypeId() != TYPEID_PLAYER || !who->GetVehicle() || who->GetVehicleBase()->GetEntry() != NPC_SEAT) + return false; + return true; + } + }; - bool CanAIAttack(const Unit *who) const + CreatureAI* GetAI(Creature* creature) const { - if (who->GetTypeId() != TYPEID_PLAYER || !who->GetVehicle() || who->GetVehicleBase()->GetEntry() != 33114) - return false; - return true; + return new boss_flame_leviathan_defense_turretAI(creature); } - }; - }; class boss_flame_leviathan_overload_device : public CreatureScript { -public: - boss_flame_leviathan_overload_device() : CreatureScript("boss_flame_leviathan_overload_device") { } - - CreatureAI* GetAI(Creature* pCreature) const - { - return new boss_flame_leviathan_overload_deviceAI (pCreature); - } + public: + boss_flame_leviathan_overload_device() : CreatureScript("boss_flame_leviathan_overload_device") { } - struct boss_flame_leviathan_overload_deviceAI : public PassiveAI - { - boss_flame_leviathan_overload_deviceAI(Creature* pCreature) : PassiveAI(pCreature) + struct boss_flame_leviathan_overload_deviceAI : public PassiveAI { - instance = pCreature->GetInstanceScript(); - } - - InstanceScript *instance; + boss_flame_leviathan_overload_deviceAI(Creature* creature) : PassiveAI(creature) + { + } - void DoAction(const int32 param) - { - if (param == EVENT_SPELLCLICK) + void DoAction(const int32 param) { - if (me->GetVehicle()) + if (param == EVENT_SPELLCLICK) { - me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - if (Unit* pPlayer = me->GetVehicle()->GetPassenger(SEAT_PLAYER)) + if (me->GetVehicle()) { - me->GetVehicleBase()->CastSpell(pPlayer, SPELL_SMOKE_TRAIL, true); - pPlayer->GetMotionMaster()->MoveKnockbackFrom(me->GetVehicleBase()->GetPositionX(), me->GetVehicleBase()->GetPositionY(), 30, 30); - pPlayer->ExitVehicle(); + me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + if (Unit* player = me->GetVehicle()->GetPassenger(SEAT_PLAYER)) + { + me->GetVehicleBase()->CastSpell(player, SPELL_SMOKE_TRAIL, true); + player->GetMotionMaster()->MoveKnockbackFrom(me->GetVehicleBase()->GetPositionX(), me->GetVehicleBase()->GetPositionY(), 30, 30); + player->ExitVehicle(); + } } } } - } - }; + }; + CreatureAI* GetAI(Creature* creature) const + { + return new boss_flame_leviathan_overload_deviceAI(creature); + } }; class boss_flame_leviathan_safety_container : public CreatureScript { -public: - boss_flame_leviathan_safety_container() : CreatureScript("boss_flame_leviathan_safety_container") { } - - CreatureAI* GetAI(Creature* pCreature) const - { - return new boss_flame_leviathan_safety_containerAI(pCreature); - } + public: + boss_flame_leviathan_safety_container() : CreatureScript("boss_flame_leviathan_safety_container") { } - struct boss_flame_leviathan_safety_containerAI : public PassiveAI - { - boss_flame_leviathan_safety_containerAI(Creature* pCreature) : PassiveAI(pCreature) + struct boss_flame_leviathan_safety_containerAI : public PassiveAI { - } + boss_flame_leviathan_safety_containerAI(Creature* creature) : PassiveAI(creature) + { + } - void JustDied(Unit* /*killer*/) - { - float x,y,z; - me->GetPosition(x,y,z); - z = me->GetMap()->GetHeight(x, y, z); - me->GetMotionMaster()->MovePoint(0,x,y,z); - me->GetMap()->CreatureRelocation(me, x,y,z,0); - } + void JustDied(Unit* /*killer*/) + { + float x,y,z; + me->GetPosition(x, y, z); + z = me->GetMap()->GetHeight(x, y, z); + me->GetMotionMaster()->MovePoint(0, x, y, z); + me->GetMap()->CreatureRelocation(me, x, y, z, 0); + } - void UpdateAI(const uint32 /*diff*/) + void UpdateAI(uint32 const /*diff*/) + { + } + }; + + CreatureAI* GetAI(Creature* creature) const { + return new boss_flame_leviathan_safety_containerAI(creature); } - }; }; class npc_mechanolift : public CreatureScript { -public: - npc_mechanolift() : CreatureScript("npc_mechanolift") { } + public: + npc_mechanolift() : CreatureScript("npc_mechanolift") { } - CreatureAI* GetAI(Creature* pCreature) const - { - return new npc_mechanoliftAI(pCreature); - } - - struct npc_mechanoliftAI : public PassiveAI - { - npc_mechanoliftAI(Creature* pCreature) : PassiveAI(pCreature), vehicle(pCreature->GetVehicleKit()) + struct npc_mechanoliftAI : public PassiveAI { - assert(vehicle); - } - - Vehicle* vehicle; - - uint32 MoveTimer; + npc_mechanoliftAI(Creature* creature) : PassiveAI(creature) + { + ASSERT(me->GetVehicleKit()); + } - void Reset () - { - MoveTimer = 0; - me->GetMotionMaster()->MoveRandom(50); - } + uint32 MoveTimer; - void JustDied(Unit* /*pKiller*/) - { - me->GetMotionMaster()->MoveTargetedHome(); - DoCast(SPELL_DUSTY_EXPLOSION); - Creature* pLiquid = DoSummon(MOB_LIQUID, me, 0); - if (pLiquid) + void Reset() { - pLiquid->CastSpell(pLiquid, SPELL_LIQUID_PYRITE, true); - pLiquid->CastSpell(pLiquid, SPELL_DUST_CLOUD_IMPACT, true); + MoveTimer = 0; + me->GetMotionMaster()->MoveRandom(50); } - } + void JustDied(Unit* /*killer*/) + { + me->GetMotionMaster()->MoveTargetedHome(); + DoCast(SPELL_DUSTY_EXPLOSION); + Creature* liquid = DoSummon(NPC_LIQUID, me, 0); + if (liquid) + { + liquid->CastSpell(liquid, SPELL_LIQUID_PYRITE, true); + liquid->CastSpell(liquid, SPELL_DUST_CLOUD_IMPACT, true); + } + } - void MovementInform(uint32 /*type*/, uint32 id) - { - if (id == 1) + void MovementInform(uint32 type, uint32 id) { - Creature* pContainer = me->FindNearestCreature(MOB_CONTAINER, 5, true); - if (pContainer) - pContainer->EnterVehicle(me); + if (type == POINT_MOTION_TYPE && id == 1) + if (Creature* container = me->FindNearestCreature(NPC_CONTAINER, 5, true)) + container->EnterVehicle(me); } - } - void UpdateAI(const uint32 diff) - { - if (MoveTimer <= diff) + void UpdateAI(const uint32 diff) { - if (me->GetVehicleKit()->HasEmptySeat(-1)) + if (MoveTimer <= diff) { - Creature* pContainer = me->FindNearestCreature(MOB_CONTAINER, 50, true); - if (pContainer && !pContainer->GetVehicle()) - me->GetMotionMaster()->MovePoint(1,pContainer->GetPositionX(),pContainer->GetPositionY(),pContainer->GetPositionZ()); + if (me->GetVehicleKit()->HasEmptySeat(-1)) + { + Creature* container = me->FindNearestCreature(NPC_CONTAINER, 50, true); + if (container && !container->GetVehicle()) + me->GetMotionMaster()->MovePoint(1, container->GetPositionX(), container->GetPositionY(), container->GetPositionZ()); + } + + MoveTimer = 30000; //check next 30 seconds } - MoveTimer = 30000; //check next 30 seconds + else + MoveTimer -= diff; } - else - MoveTimer-=diff; - } - }; + }; + CreatureAI* GetAI(Creature* creature) const + { + return new npc_mechanoliftAI(creature); + } }; +// WHY IS THIS CALLED spell_??? class spell_pool_of_tar : public CreatureScript { -public: - spell_pool_of_tar() : CreatureScript("spell_pool_of_tar") { } - - CreatureAI* GetAI(Creature* pCreature) const - { - return new spell_pool_of_tarAI (pCreature); - } + public: + spell_pool_of_tar() : CreatureScript("spell_pool_of_tar") { } - struct spell_pool_of_tarAI : public PassiveAI - { - spell_pool_of_tarAI(Creature* pCreature) : PassiveAI(pCreature) + struct spell_pool_of_tarAI : public PassiveAI { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->AddAura(SPELL_TAR_PASSIVE, me); - } + spell_pool_of_tarAI(Creature* creature) : PassiveAI(creature) + { + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->AddAura(SPELL_TAR_PASSIVE, me); + } - void DamageTaken(Unit * /*who*/, uint32 &damage) - { - damage = 0; - } + void DamageTaken(Unit* /*who*/, uint32& damage) + { + damage = 0; + } - void SpellHit(Unit* /*caster*/, const SpellEntry* pSpell) + void SpellHit(Unit* /*caster*/, SpellEntry const* spell) + { + if (spell->SchoolMask & SPELL_SCHOOL_MASK_FIRE && !me->HasAura(SPELL_BLAZE)) + me->CastSpell(me, SPELL_BLAZE, true); + } + }; + + CreatureAI* GetAI(Creature* creature) const { - if (pSpell->SchoolMask & SPELL_SCHOOL_MASK_FIRE && !me->HasAura(SPELL_BLAZE)) - me->CastSpell(me, SPELL_BLAZE, true); + return new spell_pool_of_tarAI(creature); } - }; - }; class npc_colossus : public CreatureScript { -public: - npc_colossus() : CreatureScript("npc_colossus") { } - - CreatureAI* GetAI(Creature* pCreature) const - { - return new npc_colossusAI(pCreature); - } + public: + npc_colossus() : CreatureScript("npc_colossus") { } - struct npc_colossusAI : public ScriptedAI - { - npc_colossusAI(Creature* pCreature) : ScriptedAI(pCreature) + struct npc_colossusAI : public ScriptedAI { - instance = pCreature->GetInstanceScript(); - } + npc_colossusAI(Creature* creature) : ScriptedAI(creature) + { + instance = creature->GetInstanceScript(); + } - InstanceScript *instance; + InstanceScript *instance; - void JustDied(Unit* /*Who*/) - { - if (me->GetHomePosition().IsInDist(Center,50.f)) - instance->SetData(TYPE_COLOSSUS,instance->GetData(TYPE_COLOSSUS)+1); - } + void JustDied(Unit* /*Who*/) + { + if (me->GetHomePosition().IsInDist(Center, 50.f)) + instance->SetData(TYPE_COLOSSUS, instance->GetData(TYPE_COLOSSUS)+1); + } + + void UpdateAI(uint32 const /*diff*/) + { + if (!UpdateVictim()) + return; + + DoMeleeAttackIfReady(); + } + }; - void UpdateAI(const uint32 /*diff*/) + CreatureAI* GetAI(Creature* creature) const { - if (!UpdateVictim()) - return; - DoMeleeAttackIfReady() ; + return new npc_colossusAI(creature); } - }; - }; class npc_thorims_hammer : public CreatureScript { -public: - npc_thorims_hammer() : CreatureScript("npc_thorims_hammer") { } + public: + npc_thorims_hammer() : CreatureScript("npc_thorims_hammer") { } - CreatureAI* GetAI(Creature* pCreature) const - { - return new npc_thorims_hammerAI(pCreature); - } - - struct npc_thorims_hammerAI : public ScriptedAI - { - npc_thorims_hammerAI(Creature* pCreature) : ScriptedAI (pCreature) + struct npc_thorims_hammerAI : public ScriptedAI { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->AddAura(AURA_DUMMY_BLUE, me); - } + npc_thorims_hammerAI(Creature* creature) : ScriptedAI(creature) + { + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->AddAura(AURA_DUMMY_BLUE, me); + } - void MoveInLineOfSight(Unit* who) - { - if (who->GetTypeId() == TYPEID_PLAYER && who->IsVehicle() && me->IsInRange(who,0,10,false)) + void MoveInLineOfSight(Unit* who) { - if (Creature* pTrigger = DoSummonFlyer(NPC_THORIM_TARGET_BEACON, me, 20, 0, 1000, TEMPSUMMON_TIMED_DESPAWN)) - pTrigger->CastSpell(who, SPELL_THORIM_S_HAMMER, true); + if (who->GetTypeId() == TYPEID_PLAYER && who->IsVehicle() && me->IsInRange(who, 0, 10, false)) + { + if (Creature* trigger = DoSummonFlyer(NPC_THORIM_TARGET_BEACON, me, 20, 0, 1000, TEMPSUMMON_TIMED_DESPAWN)) + trigger->CastSpell(who, SPELL_THORIM_S_HAMMER, true); + } } - } - void Reset () - { - } + void UpdateAI(uint32 const /*diff*/) + { + if (!me->HasAura(AURA_DUMMY_BLUE)) + me->AddAura(AURA_DUMMY_BLUE, me); - void UpdateAI(const uint32 /*diff*/) - { - if (!me->HasAura(AURA_DUMMY_BLUE)) - me->AddAura(AURA_DUMMY_BLUE, me); + UpdateVictim(); + } + }; - if (!UpdateVictim()) - return; + CreatureAI* GetAI(Creature* creature) const + { + return new npc_thorims_hammerAI(creature); } - }; - }; class npc_mimirons_inferno : public CreatureScript @@ -950,14 +963,14 @@ class npc_mimirons_inferno : public CreatureScript public: npc_mimirons_inferno() : CreatureScript("npc_mimirons_inferno") { } - CreatureAI* GetAI(Creature* pCreature) const + CreatureAI* GetAI(Creature* creature) const { - return new npc_mimirons_infernoAI(pCreature); + return new npc_mimirons_infernoAI(creature); } struct npc_mimirons_infernoAI : public npc_escortAI { - npc_mimirons_infernoAI(Creature* pCreature) : npc_escortAI(pCreature) + npc_mimirons_infernoAI(Creature* creature) : npc_escortAI(creature) { me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); me->AddAura(AURA_DUMMY_YELLOW, me); @@ -975,21 +988,19 @@ public: uint32 infernoTimer; - void UpdateAI(const uint32 diff) + void UpdateAI(uint32 const diff) { npc_escortAI::UpdateAI(diff); if (!HasEscortState(STATE_ESCORT_ESCORTING)) - { - Start(false,true,0,NULL,false,true); - } + Start(false, true, 0, NULL, false, true); else { - if(infernoTimer <= diff) + if (infernoTimer <= diff) { - if (Creature* pTrigger = DoSummonFlyer(NPC_MIMIRON_TARGET_BEACON, me, 20, 0, 1000, TEMPSUMMON_TIMED_DESPAWN)) + if (Creature* trigger = DoSummonFlyer(NPC_MIMIRON_TARGET_BEACON, me, 20, 0, 1000, TEMPSUMMON_TIMED_DESPAWN)) { - pTrigger->CastSpell(me->GetPositionX(),me->GetPositionY(),me->GetPositionZ(), SPELL_MIMIRON_S_INFERNO, true); + trigger->CastSpell(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), SPELL_MIMIRON_S_INFERNO, true); infernoTimer = 2000; } } @@ -1006,133 +1017,124 @@ public: class npc_hodirs_fury : public CreatureScript { -public: - npc_hodirs_fury() : CreatureScript("npc_hodirs_fury") { } - - CreatureAI* GetAI(Creature* pCreature) const - { - return new npc_hodirs_furyAI(pCreature); - } + public: + npc_hodirs_fury() : CreatureScript("npc_hodirs_fury") { } - struct npc_hodirs_furyAI : public ScriptedAI - { - npc_hodirs_furyAI(Creature* pCreature) : ScriptedAI (pCreature) + struct npc_hodirs_furyAI : public ScriptedAI { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->AddAura(AURA_DUMMY_GREEN, me); - } + npc_hodirs_furyAI(Creature* creature) : ScriptedAI(creature) + { + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->AddAura(AURA_DUMMY_GREEN, me); + } - void MoveInLineOfSight(Unit* who) - { - if (who->GetTypeId() == TYPEID_PLAYER && who->IsVehicle() && me->IsInRange(who,0,5,false)) + void MoveInLineOfSight(Unit* who) { - if (Creature* pTrigger = DoSummonFlyer(NPC_HODIR_TARGET_BEACON, me, 20, 0, 1000, TEMPSUMMON_TIMED_DESPAWN)) - pTrigger->CastSpell(who, SPELL_HODIR_S_FURY, true); + if (who->GetTypeId() == TYPEID_PLAYER && who->IsVehicle() && me->IsInRange(who,0,5,false)) + { + if (Creature* trigger = DoSummonFlyer(NPC_HODIR_TARGET_BEACON, me, 20, 0, 1000, TEMPSUMMON_TIMED_DESPAWN)) + trigger->CastSpell(who, SPELL_HODIR_S_FURY, true); + } } - } - void Reset() - { - } + void UpdateAI(uint32 const /*diff*/) + { + if (!me->HasAura(AURA_DUMMY_GREEN)) + me->AddAura(AURA_DUMMY_GREEN, me); - void UpdateAI(const uint32 /*diff*/) - { - if (!me->HasAura(AURA_DUMMY_GREEN)) - me->AddAura(AURA_DUMMY_GREEN, me); + UpdateVictim(); + } + }; - if (!UpdateVictim()) - return; + CreatureAI* GetAI(Creature* creature) const + { + return new npc_hodirs_furyAI(creature); } - }; - }; class npc_freyas_ward : public CreatureScript { -public: - npc_freyas_ward() : CreatureScript("npc_freyas_ward") { } + public: + npc_freyas_ward() : CreatureScript("npc_freyas_ward") { } - CreatureAI* GetAI(Creature* pCreature) const - { - return new npc_freyas_wardAI(pCreature); - } - - struct npc_freyas_wardAI : public ScriptedAI - { - npc_freyas_wardAI(Creature* pCreature) : ScriptedAI(pCreature) + struct npc_freyas_wardAI : public ScriptedAI { - me->AddAura(AURA_DUMMY_GREEN, me); - } - - uint32 summonTimer ; + npc_freyas_wardAI(Creature* creature) : ScriptedAI(creature) + { + me->AddAura(AURA_DUMMY_GREEN, me); + } - void Reset() - { - summonTimer = 5000 ; - } + uint32 summonTimer; - void UpdateAI(const uint32 diff) - { - if(summonTimer <= diff) + void Reset() { - DoCast(SPELL_FREYA_S_WARD_EFFECT_1) ; - DoCast(SPELL_FREYA_S_WARD_EFFECT_2) ; - summonTimer = 20000 ; + summonTimer = 5000; } - else - summonTimer -= diff ; - if (!me->HasAura(AURA_DUMMY_GREEN)) - me->AddAura(AURA_DUMMY_GREEN, me); + void UpdateAI(uint32 const diff) + { + if (summonTimer <= diff) + { + DoCast(SPELL_FREYA_S_WARD_EFFECT_1); + DoCast(SPELL_FREYA_S_WARD_EFFECT_2); + summonTimer = 20000; + } + else + summonTimer -= diff; - if (!UpdateVictim()) - return; - } - }; + if (!me->HasAura(AURA_DUMMY_GREEN)) + me->AddAura(AURA_DUMMY_GREEN, me); + UpdateVictim(); + } + }; + + CreatureAI* GetAI(Creature* creature) const + { + return new npc_freyas_wardAI(creature); + } }; class npc_freya_ward_summon : public CreatureScript { -public: - npc_freya_ward_summon() : CreatureScript("npc_freya_ward_summon") { } - - CreatureAI* GetAI(Creature* pCreature) const - { - return new npc_freya_ward_summonAI (pCreature); - } + public: + npc_freya_ward_summon() : CreatureScript("npc_freya_ward_summon") { } - struct npc_freya_ward_summonAI : public ScriptedAI - { - npc_freya_ward_summonAI(Creature* pCreature) : ScriptedAI(pCreature) + struct npc_freya_ward_summonAI : public ScriptedAI { - pCreature->GetMotionMaster()->MoveRandom(100); - } - - uint32 lashTimer ; + npc_freya_ward_summonAI(Creature* creature) : ScriptedAI(creature) + { + creature->GetMotionMaster()->MoveRandom(100); + } - void Reset() - { - lashTimer = 5000 ; - } + uint32 lashTimer; - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + void Reset() + { + lashTimer = 5000; + } - if(lashTimer <= diff) + void UpdateAI(uint32 const diff) { - DoCast(SPELL_LASH); - lashTimer = 20000; + if (!UpdateVictim()) + return; + + if (lashTimer <= diff) + { + DoCast(SPELL_LASH); + lashTimer = 20000; + } + else + lashTimer -= diff; + + DoMeleeAttackIfReady(); } - else - lashTimer -= diff; + }; - DoMeleeAttackIfReady(); + CreatureAI* GetAI(Creature* creature) const + { + return new npc_freya_ward_summonAI(creature); } - }; - }; //npc lore keeper @@ -1140,91 +1142,91 @@ public: #define GOSSIP_ITEM_2 "Confirmed" class npc_lorekeeper : public CreatureScript { -public: - npc_lorekeeper() : CreatureScript("npc_lorekeeper") { } + public: + npc_lorekeeper() : CreatureScript("npc_lorekeeper") { } - bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) - { - pPlayer->PlayerTalkClass->ClearMenus(); - InstanceScript* instance = pCreature->GetInstanceScript(); - switch(uiAction) + struct npc_lorekeeperAI : public ScriptedAI { - case GOSSIP_ACTION_INFO_DEF+1: - if (pPlayer) + npc_lorekeeperAI(Creature* creature) : ScriptedAI(creature) { - pPlayer->PrepareGossipMenu(pCreature); - instance->instance->LoadGrid(364,-16); //make sure leviathan is loaded - - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT,GOSSIP_ITEM_2,GOSSIP_SENDER_MAIN,GOSSIP_ACTION_INFO_DEF+2); - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); } - break; - case GOSSIP_ACTION_INFO_DEF+2: - if (pPlayer) - pPlayer->CLOSE_GOSSIP_MENU(); - if (Creature* pLeviathan = instance->instance->GetCreature(instance->GetData64(TYPE_LEVIATHAN))) + void DoAction(int32 const action) { - CAST_AI(boss_flame_leviathan::boss_flame_leviathanAI, (pLeviathan->AI()))->DoAction(0); //enable hard mode activating the 4 additional events spawning additional vehicles - pCreature->SetVisible(false); - pCreature->AI()->DoAction(0); // spawn the vehicles - if (Creature* Delorah = pCreature->FindNearestCreature(NPC_DELORAH, 1000, true)) + // Start encounter + if (action == 0) { - if (Creature* Branz = pCreature->FindNearestCreature(NPC_BRANZ_BRONZBEARD, 1000, true)) - { - Delorah->GetMotionMaster()->MovePoint(0, Branz->GetPositionX()-4, Branz->GetPositionY(), Branz->GetPositionZ()); - //TODO DoScriptText(xxxx, Delorah, Branz); when reached at branz - } + for (int32 i = 0; i < RAID_MODE(2, 5); ++i) + DoSummon(VEHICLE_SIEGE, PosSiege[i], 3000, TEMPSUMMON_CORPSE_TIMED_DESPAWN); + for (int32 i = 0; i < RAID_MODE(2, 5); ++i) + DoSummon(VEHICLE_CHOPPER, PosChopper[i], 3000, TEMPSUMMON_CORPSE_TIMED_DESPAWN); + for (int32 i = 0; i < RAID_MODE(2, 5); ++i) + DoSummon(VEHICLE_DEMOLISHER, PosDemolisher[i], 3000, TEMPSUMMON_CORPSE_TIMED_DESPAWN); + return; } } - break; - } - return true; - } + }; - bool OnGossipHello(Player* pPlayer, Creature* pCreature) - { - InstanceScript* instance = pCreature->GetInstanceScript(); - if (instance && instance->GetData(TYPE_LEVIATHAN) !=DONE && pPlayer) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 action) { - pPlayer->PrepareGossipMenu(pCreature); + player->PlayerTalkClass->ClearMenus(); + InstanceScript* instance = creature->GetInstanceScript(); + if (!instance) + return true; - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT,GOSSIP_ITEM_1,GOSSIP_SENDER_MAIN,GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - } - return true; - } + switch (action) + { + case GOSSIP_ACTION_INFO_DEF+1: + if (player) + { + player->PrepareGossipMenu(creature); + instance->instance->LoadGrid(364,-16); //make sure leviathan is loaded - CreatureAI* GetAI(Creature* pCreature) const - { - return new npc_lorekeeperAI (pCreature); - } + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT,GOSSIP_ITEM_2,GOSSIP_SENDER_MAIN,GOSSIP_ACTION_INFO_DEF+2); + player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); + } + break; + case GOSSIP_ACTION_INFO_DEF+2: + if (player) + player->CLOSE_GOSSIP_MENU(); - struct npc_lorekeeperAI : public ScriptedAI - { - npc_lorekeeperAI(Creature* pCreature) : ScriptedAI(pCreature) - { - instance = pCreature->GetInstanceScript(); - } + if (Creature* leviathan = instance->instance->GetCreature(instance->GetData64(TYPE_LEVIATHAN))) + { + CAST_AI(boss_flame_leviathan::boss_flame_leviathanAI, (leviathan->AI()))->DoAction(0); //enable hard mode activating the 4 additional events spawning additional vehicles + creature->SetVisible(false); + creature->AI()->DoAction(0); // spawn the vehicles + if (Creature* Delorah = creature->FindNearestCreature(NPC_DELORAH, 1000, true)) + { + if (Creature* Branz = creature->FindNearestCreature(NPC_BRANZ_BRONZBEARD, 1000, true)) + { + Delorah->GetMotionMaster()->MovePoint(0, Branz->GetPositionX()-4, Branz->GetPositionY(), Branz->GetPositionZ()); + //TODO DoScriptText(xxxx, Delorah, Branz); when reached at branz + } + } + } + break; + } - InstanceScript* instance; + return true; + } - void DoAction(const int32 uiAction) + bool OnGossipHello(Player* player, Creature* creature) { - // Start encounter - if (uiAction == 0) + InstanceScript* instance = creature->GetInstanceScript(); + if (instance && instance->GetData(TYPE_LEVIATHAN) !=DONE && player) { - for (int32 i = 0; i < RAID_MODE(2, 5); ++i) - DoSummon(VEHICLE_SIEGE, PosSiege[i], 3000, TEMPSUMMON_CORPSE_TIMED_DESPAWN); - for (int32 i = 0; i < RAID_MODE(2, 5); ++i) - DoSummon(VEHICLE_CHOPPER, PosChopper[i], 3000, TEMPSUMMON_CORPSE_TIMED_DESPAWN); - for (int32 i = 0; i < RAID_MODE(2, 5); ++i) - DoSummon(VEHICLE_DEMOLISHER, PosDemolisher[i], 3000, TEMPSUMMON_CORPSE_TIMED_DESPAWN); - return; + player->PrepareGossipMenu(creature); + + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT,GOSSIP_ITEM_1,GOSSIP_SENDER_MAIN,GOSSIP_ACTION_INFO_DEF+1); + player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); } + return true; } - }; + CreatureAI* GetAI(Creature* creature) const + { + return new npc_lorekeeperAI(creature); + } }; //enable hardmode @@ -1238,7 +1240,7 @@ class npc_brann_bronzebeard : public CreatureScript public: npc_brann_bronzebeard() : CreatureScript("npc_brann_bronzebeard") { } - //bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) + //bool OnGossipSelect(Player* pPlayer, Creature* creature, uint32 uiSender, uint32 uiAction) //{ // pPlayer->PlayerTalkClass->ClearMenus(); // switch(uiAction) @@ -1246,30 +1248,30 @@ public: // case GOSSIP_ACTION_INFO_DEF+1: // if (pPlayer) // { - // pPlayer->PrepareGossipMenu(pCreature); + // pPlayer->PrepareGossipMenu(creature); // // pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT,GOSSIP_ITEM_2,GOSSIP_SENDER_MAIN,GOSSIP_ACTION_INFO_DEF+2); - // pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + // pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(creature), creature->GetGUID()); // } // break; // case GOSSIP_ACTION_INFO_DEF+2: // if (pPlayer) // pPlayer->CLOSE_GOSSIP_MENU(); - // if (Creature* Lorekeeper = pCreature->FindNearestCreature(NPC_LOREKEEPER, 1000, true)) //lore keeper of lorgannon + // if (Creature* Lorekeeper = creature->FindNearestCreature(NPC_LOREKEEPER, 1000, true)) //lore keeper of lorgannon // Lorekeeper->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); // break; // } // return true; //} - //bool OnGossipHello(Player* pPlayer, Creature* pCreature) + //bool OnGossipHello(Player* pPlayer, Creature* creature) //{ - // InstanceScript* instance = pCreature->GetInstanceScript(); + // InstanceScript* instance = creature->GetInstanceScript(); // if (instance && instance->GetData(TYPE_LEVIATHAN) !=DONE) // { - // pPlayer->PrepareGossipMenu(pCreature); + // pPlayer->PrepareGossipMenu(creature); // // pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT,GOSSIP_ITEM_1,GOSSIP_SENDER_MAIN,GOSSIP_ACTION_INFO_DEF+1); - // pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + // pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(creature), creature->GetGUID()); // } // return true; //} @@ -1279,52 +1281,140 @@ public: class go_ulduar_tower : public GameObjectScript { -public: - go_ulduar_tower() : GameObjectScript("go_ulduar_tower") { } + public: + go_ulduar_tower() : GameObjectScript("go_ulduar_tower") { } - void OnDestroyed(Player* /*pPlayer*/, GameObject* pGO, uint32 /*value*/) - { - InstanceScript* instance = pGO->GetInstanceScript(); - switch(pGO->GetEntry()) + void OnDestroyed(Player* /*pPlayer*/, GameObject* go, uint32 /*value*/) { - case GO_TOWER_OF_STORMS: - instance->ProcessEvent(pGO, EVENT_TOWER_OF_STORM_DESTROYED); - break; - case GO_TOWER_OF_FLAMES: - instance->ProcessEvent(pGO, EVENT_TOWER_OF_FLAMES_DESTROYED); - break; - case GO_TOWER_OF_FROST: - instance->ProcessEvent(pGO, EVENT_TOWER_OF_FROST_DESTROYED); - break; - case GO_TOWER_OF_LIFE: - instance->ProcessEvent(pGO, EVENT_TOWER_OF_LIFE_DESTROYED); - break; - } + InstanceScript* instance = go->GetInstanceScript(); + if (!instance) + return; - Creature* trigger = pGO->FindNearestCreature(NPC_ULDUAR_GAUNTLET_GENERATOR, 15.0f, true); - if (trigger) - trigger->DisappearAndDie(); - } + switch (go->GetEntry()) + { + case GO_TOWER_OF_STORMS: + instance->ProcessEvent(go, EVENT_TOWER_OF_STORM_DESTROYED); + break; + case GO_TOWER_OF_FLAMES: + instance->ProcessEvent(go, EVENT_TOWER_OF_FLAMES_DESTROYED); + break; + case GO_TOWER_OF_FROST: + instance->ProcessEvent(go, EVENT_TOWER_OF_FROST_DESTROYED); + break; + case GO_TOWER_OF_LIFE: + instance->ProcessEvent(go, EVENT_TOWER_OF_LIFE_DESTROYED); + break; + } + + Creature* trigger = go->FindNearestCreature(NPC_ULDUAR_GAUNTLET_GENERATOR, 15.0f, true); + if (trigger) + trigger->DisappearAndDie(); + } }; class at_RX_214_repair_o_matic_station : public AreaTriggerScript { -public: - at_RX_214_repair_o_matic_station() : AreaTriggerScript("at_RX_214_repair_o_matic_station") { } + public: + at_RX_214_repair_o_matic_station() : AreaTriggerScript("at_RX_214_repair_o_matic_station") { } - bool OnTrigger(Player* pPlayer, const AreaTriggerEntry* /*pAt*/) - { - if(Creature* vehicle = pPlayer->GetVehicleCreatureBase()) + bool OnTrigger(Player* player, const AreaTriggerEntry* /*at*/) { - if(!vehicle->HasAura(SPELL_AUTO_REPAIR)) + InstanceScript* instance = player->GetInstanceScript(); + if (Creature* vehicle = player->GetVehicleCreatureBase()) { - pPlayer->MonsterTextEmote(EMOTE_REPAIR, pPlayer->GetGUID(), true); - pPlayer->CastSpell(vehicle, SPELL_AUTO_REPAIR, true); + if (!vehicle->HasAura(SPELL_AUTO_REPAIR)) + { + player->MonsterTextEmote(EMOTE_REPAIR, player->GetGUID(), true); + player->CastSpell(vehicle, SPELL_AUTO_REPAIR, true); + if (Creature* leviathan = ObjectAccessor::GetCreature(*player, instance ? instance->GetData64(TYPE_LEVIATHAN) : 0)) + leviathan->AI()->SetData(DATA_UNBROKEN, 0); // set bool to false thats checked in leviathan getdata + } } + return true; } - return true; - } +}; + +class achievement_three_car_garage_demolisher : public AchievementCriteriaScript +{ + public: + achievement_three_car_garage_demolisher() : AchievementCriteriaScript("achievement_three_car_garage_demolisher") { } + bool OnCheck(Player* source, Unit* /*target*/) + { + if (Creature* vehicle = source->GetVehicleCreatureBase()) + { + if (vehicle->GetEntry() == VEHICLE_DEMOLISHER) + return true; + } + + return false; + } +}; + +class achievement_three_car_garage_chopper : public AchievementCriteriaScript +{ + public: + achievement_three_car_garage_chopper() : AchievementCriteriaScript("achievement_three_car_garage_chopper") { } + + bool OnCheck(Player* source, Unit* /*target*/) + { + if (Creature* vehicle = source->GetVehicleCreatureBase()) + { + if (vehicle->GetEntry() == VEHICLE_CHOPPER) + return true; + } + + return false; + } +}; + +class achievement_three_car_garage_siege : public AchievementCriteriaScript +{ + public: + achievement_three_car_garage_siege() : AchievementCriteriaScript("achievement_three_car_garage_siege") { } + + bool OnCheck(Player* source, Unit* /*target*/) + { + if (Creature* vehicle = source->GetVehicleCreatureBase()) + { + if (vehicle->GetEntry() == VEHICLE_SIEGE) + return true; + } + + return false; + } +}; + +class achievement_shutout : public AchievementCriteriaScript +{ + public: + achievement_shutout() : AchievementCriteriaScript("achievement_shutout") { } + + bool OnCheck(Player* /*source*/, Unit* target) + { + if (target) + if (Creature* leviathan = target->ToCreature()) + if (leviathan->AI()->GetData(DATA_SHUTOUT)) + return true; + + return false; + } +}; + +class achievement_unbroken : public AchievementCriteriaScript +{ + public: + achievement_unbroken() : AchievementCriteriaScript("achievement_unbroken") { } + + bool OnCheck(Player* /*source*/, Unit* target) + { + if (target) + if (Creature* leviathan = target->ToCreature()) + if (leviathan->AI()->GetData(DATA_UNBROKEN)) + return true; + + return false; + } }; void AddSC_boss_flame_leviathan() @@ -1347,4 +1437,9 @@ void AddSC_boss_flame_leviathan() // new npc_brann_bronzebeard(); new go_ulduar_tower(); new at_RX_214_repair_o_matic_station(); + new achievement_three_car_garage_demolisher(); + new achievement_three_car_garage_chopper(); + new achievement_three_car_garage_siege(); + new achievement_shutout(); + new achievement_unbroken(); } diff --git a/src/server/scripts/Northrend/Ulduar/ulduar/boss_razorscale.cpp b/src/server/scripts/Northrend/Ulduar/ulduar/boss_razorscale.cpp index 3690f9cd7fb..873b5f4867c 100644 --- a/src/server/scripts/Northrend/Ulduar/ulduar/boss_razorscale.cpp +++ b/src/server/scripts/Northrend/Ulduar/ulduar/boss_razorscale.cpp @@ -87,8 +87,6 @@ enum Actions ACTION_GROUND_PHASE = 2, ACTION_HARPOON_BUILD = 3, ACTION_PLACE_BROKEN_HARPOON = 4, - ACTION_HARPOON_VISUAL = 5, - ACTION_HARPOON_CAST = 6, ACTION_COMMANDER_RESET = 7, }; @@ -350,6 +348,8 @@ class boss_razorscale : public CreatureScript void JustDied(Unit* /*who*/) { _JustDied(); + if (Creature* controller = ObjectAccessor::GetCreature(*me, instance ? instance->GetData64(DATA_RAZORSCALE_CONTROL) : 0)) + controller->AI()->Reset(); } void SpellHit(Unit* /*caster*/, SpellEntry const* spell) diff --git a/src/server/scripts/Northrend/Ulduar/ulduar/instance_ulduar.cpp b/src/server/scripts/Northrend/Ulduar/ulduar/instance_ulduar.cpp index 27fbb3ff047..3aa1c554a02 100644 --- a/src/server/scripts/Northrend/Ulduar/ulduar/instance_ulduar.cpp +++ b/src/server/scripts/Northrend/Ulduar/ulduar/instance_ulduar.cpp @@ -40,7 +40,6 @@ public: uint32 uiEncounter[MAX_ENCOUNTER]; std::string m_strInstData; - uint8 flag; uint64 uiLeviathanGUID; uint64 uiIgnisGUID; @@ -101,7 +100,6 @@ public: uiFreyaChestGUID = 0; uiLeviathanGateGUID = 0; uiVezaxDoorGUID = 0; - flag = 0; memset(uiEncounter, 0, sizeof(uiEncounter)); memset(uiAssemblyGUIDs, 0, sizeof(uiAssemblyGUIDs)); @@ -417,20 +415,6 @@ public: return 0; } - bool CheckAchievementCriteriaMeet(uint32 criteria_id, Player const* /*source*/, Unit const* /*target*/, uint32 /*miscvalue1*/) - { - switch (criteria_id) - { - case ACHIEVEMENT_CRITERIA_HOT_POCKET_10: - return true; - case ACHIEVEMENT_CRITERIA_HOT_POCKET_25: - return true; - default: - break; - } - return false; - } - uint32 GetData(uint32 type) { switch(type) diff --git a/src/server/scripts/Northrend/Ulduar/ulduar/ulduar.h b/src/server/scripts/Northrend/Ulduar/ulduar/ulduar.h index 5015cb0df4f..5a405a02fdb 100644 --- a/src/server/scripts/Northrend/Ulduar/ulduar/ulduar.h +++ b/src/server/scripts/Northrend/Ulduar/ulduar/ulduar.h @@ -115,8 +115,20 @@ enum eTowerEvents enum eAchievementCriteria { - ACHIEVEMENT_CRITERIA_HOT_POCKET_10 = 10430, //ignis + ACHIEVEMENT_UNBROKEN_10 = 10044, // Leviathan + ACHIEVEMENT_UNBROKEN_25 = 10045, + ACHIEVEMENT_CRITERIA_SHUTOUT_10 = 10054, + ACHIEVEMENT_CRITERIA_SHUTOUT_25 = 10055, + ACHIEVEMENT_CRITERIA_3_CAR_GARAGE_CHOPPER_10 = 10046, + ACHIEVEMENT_CRITERIA_3_CAR_GARAGE_SIEGE_10 = 10047, + ACHIEVEMENT_CRITERIA_3_CAR_GARAGE_DEMOLISHER_10 = 10048, + ACHIEVEMENT_CRITERIA_3_CAR_GARAGE_CHOPPER_25 = 10049, + ACHIEVEMENT_CRITERIA_3_CAR_GARAGE_SIEGE_25 = 10050, + ACHIEVEMENT_CRITERIA_3_CAR_GARAGE_DEMOLISHER_25 = 10051, + ACHIEVEMENT_CRITERIA_HOT_POCKET_10 = 10430, // Ignis ACHIEVEMENT_CRITERIA_HOT_POCKET_25 = 10431, + ACHIEVEMENT_CRITERIA_QUICK_SHAVE_10 = 10062, // Razorscale + ACHIEVEMENT_CRITERIA_QUICK_SHAVE_25 = 10063, }; #endif |
