diff options
5 files changed, 68 insertions, 113 deletions
diff --git a/sql/updates/world/2014_09_11_00_world_conditions.sql b/sql/updates/world/2014_09_11_00_world_conditions.sql index 17052ef159f..bd788917487 100644 --- a/sql/updates/world/2014_09_11_00_world_conditions.sql +++ b/sql/updates/world/2014_09_11_00_world_conditions.sql @@ -1 +1 @@ -UPDATE `conditions` SET `ConditionValue1` = 46 WHERE `SourceEntry` IN (63989, 63997, 63998);
+UPDATE `conditions` SET `ConditionValue1` = 46 WHERE `SourceEntry` AND `SourceTypeOrReferenceId` = 18 IN (63989, 63997, 63998);
diff --git a/sql/updates/world/2014_09_11_01_world_creature_template.sql b/sql/updates/world/2014_09_11_01_world_creature_template.sql new file mode 100644 index 00000000000..59d0bf9d3dd --- /dev/null +++ b/sql/updates/world/2014_09_11_01_world_creature_template.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName` = '' WHERE `entry` = 29920;
diff --git a/src/server/scripts/Northrend/Gundrak/boss_eck.cpp b/src/server/scripts/Northrend/Gundrak/boss_eck.cpp index 0783a79b381..4803cb4934f 100644 --- a/src/server/scripts/Northrend/Gundrak/boss_eck.cpp +++ b/src/server/scripts/Northrend/Gundrak/boss_eck.cpp @@ -28,146 +28,93 @@ enum Spells SPELL_ECK_SPRING_2 = 55837 //Eck leaps at a distant target. }; -static Position EckSpawnPoint = { 1643.877930f, 936.278015f, 107.204948f, 0.668432f }; +enum Events +{ + EVENT_BITE = 1, + EVENT_SPIT, + EVENT_SPRING, + EVENT_BERSERK +}; class boss_eck : public CreatureScript { public: boss_eck() : CreatureScript("boss_eck") { } - CreatureAI* GetAI(Creature* creature) const override + struct boss_eckAI : public BossAI { - return GetInstanceAI<boss_eckAI>(creature); - } - - struct boss_eckAI : public ScriptedAI - { - boss_eckAI(Creature* creature) : ScriptedAI(creature) + boss_eckAI(Creature* creature) : BossAI(creature, DATA_ECK_THE_FEROCIOUS_EVENT) { - Initialize(); - instance = creature->GetInstanceScript(); - } - - void Initialize() - { - uiBerserkTimer = urand(60 * IN_MILLISECONDS, 90 * IN_MILLISECONDS); //60-90 secs according to wowwiki - uiBiteTimer = 5 * IN_MILLISECONDS; - uiSpitTimer = 10 * IN_MILLISECONDS; - uiSpringTimer = 8 * IN_MILLISECONDS; - - bBerserk = false; + Berserk = false; } - uint32 uiBerserkTimer; - uint32 uiBiteTimer; - uint32 uiSpitTimer; - uint32 uiSpringTimer; - - bool bBerserk; - - InstanceScript* instance; - void Reset() override { - Initialize(); - - instance->SetData(DATA_ECK_THE_FEROCIOUS_EVENT, NOT_STARTED); + _Reset(); + Berserk = false; } void EnterCombat(Unit* /*who*/) override { - instance->SetData(DATA_ECK_THE_FEROCIOUS_EVENT, IN_PROGRESS); + _EnterCombat(); + events.ScheduleEvent(EVENT_BITE, 5 * IN_MILLISECONDS); + events.ScheduleEvent(EVENT_SPIT, 10 * IN_MILLISECONDS); + events.ScheduleEvent(EVENT_SPRING, 8 * IN_MILLISECONDS); + events.ScheduleEvent(EVENT_BERSERK, urand(60 * IN_MILLISECONDS, 90 * IN_MILLISECONDS)); //60-90 secs according to wowwiki } - void UpdateAI(uint32 diff) override + void DamageTaken(Unit* /*attacker*/, uint32& damage) override { - //Return since we have no target - if (!UpdateVictim()) - return; - - if (uiBiteTimer <= diff) + if (me->HealthBelowPctDamaged(20, damage) && !Berserk) { - DoCastVictim(SPELL_ECK_BITE); - uiBiteTimer = urand(8*IN_MILLISECONDS, 12*IN_MILLISECONDS); - } else uiBiteTimer -= diff; - - if (uiSpitTimer <= diff) - { - DoCastVictim(SPELL_ECK_SPIT); - uiSpitTimer = urand(6*IN_MILLISECONDS, 14*IN_MILLISECONDS); - } else uiSpitTimer -= diff; - - if (uiSpringTimer <= diff) - { - Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1); - if (target && target->GetTypeId() == TYPEID_PLAYER) - { - DoCast(target, RAND(SPELL_ECK_SPRING_1, SPELL_ECK_SPRING_2)); - uiSpringTimer = urand(5*IN_MILLISECONDS, 10*IN_MILLISECONDS); - } - } else uiSpringTimer -= diff; + events.RescheduleEvent(EVENT_BERSERK, 1000); + Berserk = true; + } + } - //Berserk on timer or 20% of health - if (!bBerserk) + void ExecuteEvent(uint32 eventId) override + { + switch (eventId) { - if (uiBerserkTimer <= diff) - { + case EVENT_BITE: + DoCastVictim(SPELL_ECK_BITE); + events.ScheduleEvent(EVENT_BITE, urand(8 * IN_MILLISECONDS, 12 * IN_MILLISECONDS)); + break; + case EVENT_SPIT: + DoCastVictim(SPELL_ECK_SPIT); + events.ScheduleEvent(EVENT_SPIT, urand(6 * IN_MILLISECONDS, 14 * IN_MILLISECONDS)); + break; + case EVENT_SPRING: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1)) + if (target->GetTypeId() == TYPEID_PLAYER) + DoCast(target, RAND(SPELL_ECK_SPRING_1, SPELL_ECK_SPRING_2)); + events.ScheduleEvent(EVENT_SPRING, urand(5 * IN_MILLISECONDS, 10 * IN_MILLISECONDS)); + break; + case EVENT_BERSERK: DoCast(me, SPELL_ECK_BERSERK); - bBerserk = true; - } - else - { - uiBerserkTimer -= diff; - if (HealthBelowPct(20)) - { - DoCast(me, SPELL_ECK_BERSERK); - bBerserk = true; - } - } + Berserk = true; + break; + default: + break; } - - DoMeleeAttackIfReady(); } void JustDied(Unit* /*killer*/) override { - instance->SetData(DATA_ECK_THE_FEROCIOUS_EVENT, DONE); + _JustDied(); } - }; - -}; -class npc_ruins_dweller : public CreatureScript -{ -public: - npc_ruins_dweller() : CreatureScript("npc_ruins_dweller") { } + private: + bool Berserk; + }; CreatureAI* GetAI(Creature* creature) const override { - return GetInstanceAI<npc_ruins_dwellerAI>(creature); + return GetInstanceAI<boss_eckAI>(creature); } - - struct npc_ruins_dwellerAI : public ScriptedAI - { - npc_ruins_dwellerAI(Creature* creature) : ScriptedAI(creature) - { - instance = creature->GetInstanceScript(); - } - - InstanceScript* instance; - - void JustDied(Unit* /*killer*/) override - { - instance->SetData64(DATA_RUIN_DWELLER_DIED, me->GetGUID()); - if (instance->GetData(DATA_ALIVE_RUIN_DWELLERS) == 0) - me->SummonCreature(CREATURE_ECK, EckSpawnPoint, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300*IN_MILLISECONDS); - } - }; - }; void AddSC_boss_eck() { new boss_eck(); - new npc_ruins_dweller(); } diff --git a/src/server/scripts/Northrend/Gundrak/gundrak.h b/src/server/scripts/Northrend/Gundrak/gundrak.h index 8f269705a45..fffeca82f39 100644 --- a/src/server/scripts/Northrend/Gundrak/gundrak.h +++ b/src/server/scripts/Northrend/Gundrak/gundrak.h @@ -26,8 +26,7 @@ enum Data DATA_MOORABI_EVENT, DATA_DRAKKARI_COLOSSUS_EVENT, DATA_GAL_DARAH_EVENT, - DATA_ECK_THE_FEROCIOUS_EVENT, - DATA_ALIVE_RUIN_DWELLERS + DATA_ECK_THE_FEROCIOUS_EVENT }; enum Data64 @@ -39,8 +38,7 @@ enum Data64 DATA_MOORABI_STATUE, DATA_DRAKKARI_COLOSSUS_STATUE, DATA_DRAKKARI_COLOSSUS, - DATA_RUIN_DWELLER_DIED, - DATA_STATUE_ACTIVATE, + DATA_STATUE_ACTIVATE }; enum mainCreatures diff --git a/src/server/scripts/Northrend/Gundrak/instance_gundrak.cpp b/src/server/scripts/Northrend/Gundrak/instance_gundrak.cpp index e5efdad27f3..ee3069b5eb2 100644 --- a/src/server/scripts/Northrend/Gundrak/instance_gundrak.cpp +++ b/src/server/scripts/Northrend/Gundrak/instance_gundrak.cpp @@ -31,6 +31,8 @@ 4 - Eck the Ferocious */ +static Position EckSpawnPoint = {1643.877930f, 936.278015f, 107.204948f, 0.668432f}; + class instance_gundrak : public InstanceMapScript { public: @@ -274,6 +276,17 @@ public: } } + void OnUnitDeath(Unit* unit) override + { + if (unit->GetEntry() == CREATURE_RUIN_DWELLER) + { + DwellerGUIDs.erase(unit->GetGUID()); + + if (DwellerGUIDs.empty()) + unit->SummonCreature(CREATURE_ECK, EckSpawnPoint, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300 * IN_MILLISECONDS); + } + } + void SetData(uint32 type, uint32 data) override { switch (type) @@ -329,9 +342,7 @@ public: void SetData64(uint32 type, uint64 data) override { - if (type == DATA_RUIN_DWELLER_DIED) - DwellerGUIDs.erase(data); - else if (type == DATA_STATUE_ACTIVATE) + if (type == DATA_STATUE_ACTIVATE) { toActivate = data; timer = 3500; @@ -353,8 +364,6 @@ public: return m_auiEncounter[3]; case DATA_ECK_THE_FEROCIOUS_EVENT: return m_auiEncounter[4]; - case DATA_ALIVE_RUIN_DWELLERS: - return DwellerGUIDs.size(); } return 0; |