diff --git a/sql/updates/world/4.3.4/custom_2018_04_16_01_world.sql b/sql/updates/world/4.3.4/custom_2018_04_16_01_world.sql index bf24edf0d72..c4c8df92868 100644 --- a/sql/updates/world/4.3.4/custom_2018_04_16_01_world.sql +++ b/sql/updates/world/4.3.4/custom_2018_04_16_01_world.sql @@ -44,13 +44,17 @@ INSERT INTO `creature_text` (`CreatureID`, `GroupID`, `ID`, `Text`, `Type`, `Lan DELETE FROM `spell_script_names` WHERE `ScriptName` IN ('spell_halfus_bind_will', 'spell_halfus_fireball', -'spell_halfus_stone_touch'); +'spell_halfus_stone_touch', +'spell_halfus_cyclone_winds', +'spell_halfus_dancing_flames'); INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES (84246, 'spell_halfus_bind_will'), (86058, 'spell_halfus_fireball'), (83719, 'spell_halfus_fireball'), -(83603, 'spell_halfus_stone_touch'); +(83603, 'spell_halfus_stone_touch'), +(83612, 'spell_halfus_cyclone_winds'), +(83962, 'spell_halfus_dancing_flames'); -- Spellclick Spells DELETE FROM `npc_spellclick_spells` WHERE `npc_entry` IN (44645, 44652, 44650, 44797); @@ -61,7 +65,7 @@ INSERT INTO `npc_spellclick_spells` (`npc_entry`, `spell_id`, `cast_flags`, `use (44797, 83447, 1, 1); -- Conditions -DELETE FROM `conditions` WHERE `SourceEntry` IN (83487, 83611, 83603, 84092, 87683, 83601, 83609, 84246) AND `SourceTypeOrReferenceId`= 13; +DELETE FROM `conditions` WHERE `SourceEntry` IN (83487, 83611, 83603, 84092, 87683, 83601, 83609, 84246, 83962) AND `SourceTypeOrReferenceId`= 13; INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ScriptName`, `Comment`) VALUES (13, 1, 83487, 0, 0, 31, 0, 3, 44645, 0, 0, 0, '', 'Chain - Target Nether Scion'), (13, 1, 83487, 0, 1, 31, 0, 3, 44652, 0, 0, 0, '', 'Chain - Target Slate Dragon'), @@ -73,7 +77,8 @@ INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry (13, 1, 87683, 0, 0, 31, 0, 3, 44600, 0, 0, 0, '', 'Dragon''s Vengeance - Target Halfus Wyrmbreaker'), (13, 1, 84246, 0, 0, 31, 0, 3, 44600, 0, 0, 0, '', 'Bind Will - Target Halfus Wyrmbreaker'), (13, 1, 83601, 0, 0, 31, 0, 3, 44687, 0, 0, 0, '', 'Time Dilation - Target Proto-Behemoth'), -(13, 1, 83609, 0, 0, 31, 0, 3, 44687, 0, 0, 0, '', 'Atrophic Poison - Target Proto-Behemoth'); +(13, 1, 83609, 0, 0, 31, 0, 3, 44687, 0, 0, 0, '', 'Atrophic Poison - Target Proto-Behemoth'), +(13, 1, 83962, 0, 0, 31, 0, 3, 42098, 0, 0, 0, '', 'Dancing Flames - Target Cataclysm Stalker'); -- Creature Spike 44765 SAI SET @ENTRY := 44765; @@ -142,3 +147,11 @@ INSERT INTO `creature_loot_template` (`Entry`, `Item`, `Chance`, `LootMode`, `Re DELETE FROM `achievement_criteria_data` WHERE `ScriptName`= 'achievement_the_only_escape'; INSERT INTO `achievement_criteria_data` (`criteria_id`, `type`, `value1`, `value2`, `ScriptName`) VALUES (15094, 11, 0, 0, 'achievement_the_only_escape'); + +-- Currency loot +DELETE FROM `creature_onkill_reward` WHERE `creature_id` IN (44600, 46209, 46210, 46211); +INSERT INTO `creature_onkill_reward` (`creature_id`, `CurrencyId1`, `CurrencyCount1`) VALUES +(44600, 396, 10000), +(46209, 396, 10000), +(46210, 396, 10000), +(46211, 396, 10000); diff --git a/src/server/scripts/EasternKingdoms/BastionOfTwilight/bastion_of_twilight.h b/src/server/scripts/EasternKingdoms/BastionOfTwilight/bastion_of_twilight.h index fef5182b3bf..3248510c482 100644 --- a/src/server/scripts/EasternKingdoms/BastionOfTwilight/bastion_of_twilight.h +++ b/src/server/scripts/EasternKingdoms/BastionOfTwilight/bastion_of_twilight.h @@ -83,7 +83,10 @@ enum BoTCreatures NPC_STORM_RIDER = 44650, NPC_TIME_WARDEN = 44797, NPC_ORPHANED_EMERALD_WELP = 44641, - NPC_SPIKE = 44765 + NPC_SPIKE = 44765, + + // Generic Creatures + NPC_INVISIBLE_STALKER = 42098 }; enum BoTGameObjects @@ -109,6 +112,16 @@ enum BoTActions ACTION_MOVE_OUT_OF_CAGE = 4 }; +enum BoTEvents +{ + EVENT_CAST_DANCING_FLAMES = 1 +}; + +enum BoTSpells +{ + SPELL_DANCING_FLAMES_VISUAL = 83962 +}; + template AI* GetBastionOfTwilightAI(Creature* creature) { diff --git a/src/server/scripts/EasternKingdoms/BastionOfTwilight/boss_halfus_wyrmbreaker.cpp b/src/server/scripts/EasternKingdoms/BastionOfTwilight/boss_halfus_wyrmbreaker.cpp index d9e24225f92..e676e978fcf 100644 --- a/src/server/scripts/EasternKingdoms/BastionOfTwilight/boss_halfus_wyrmbreaker.cpp +++ b/src/server/scripts/EasternKingdoms/BastionOfTwilight/boss_halfus_wyrmbreaker.cpp @@ -642,6 +642,89 @@ class spell_halfus_stone_touch : public SpellScriptLoader } }; +class spell_halfus_cyclone_winds : public SpellScriptLoader +{ + public: + spell_halfus_cyclone_winds() : SpellScriptLoader("spell_halfus_cyclone_winds") { } + + class spell_halfus_cyclone_winds_SpellScript : public SpellScript + { + PrepareSpellScript(spell_halfus_cyclone_winds_SpellScript); + + void SetDestPosition(SpellEffIndex /*effIndex*/) + { + if (Unit* caster = GetCaster()) + { + float angle = caster->GetOrientation(); + float x = caster->GetPositionX() + cos(angle) * 7.0f; + float y = caster->GetPositionY() + sin(angle) * 7.0f; + float z = caster->GetPositionZ(); + + const_cast(GetExplTargetDest())->Relocate(x, y, z); + GetHitDest()->Relocate(x, y, z); + } + } + + void Register() + { + OnEffectLaunch += SpellEffectFn(spell_halfus_cyclone_winds_SpellScript::SetDestPosition, EFFECT_0, SPELL_EFFECT_SUMMON); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_halfus_cyclone_winds_SpellScript(); + } +}; + +class DancingFlamesDistanceCheck +{ + public: + DancingFlamesDistanceCheck(Unit* caster) : _caster(caster) { } + + bool operator()(WorldObject* object) + { + return (object->GetDistance2d(_caster) <= 40.0f || object->GetDistance2d(_caster) >= 100.0f); + } + private: + Unit* _caster; +}; + +class spell_halfus_dancing_flames : public SpellScriptLoader +{ + public: + spell_halfus_dancing_flames() : SpellScriptLoader("spell_halfus_dancing_flames") { } + + class spell_halfus_dancing_flames_SpellScript : public SpellScript + { + PrepareSpellScript(spell_halfus_dancing_flames_SpellScript); + + void FilterTargets(std::list& targets) + { + if (targets.empty()) + return; + + if (Unit* caster = GetCaster()) + targets.remove_if(DancingFlamesDistanceCheck(caster)); + + if (targets.empty()) + return; + + Trinity::Containers::RandomResize(targets, 1); + } + + void Register() override + { + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_halfus_dancing_flames_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENTRY); + } + }; + + SpellScript* GetSpellScript() const override + { + return new spell_halfus_dancing_flames_SpellScript(); + } +}; + class achievement_the_only_escape : public AchievementCriteriaScript { public: @@ -665,5 +748,7 @@ void AddSC_boss_halfus_wyrmbreaker() new spell_halfus_bind_will(); new spell_halfus_fireball(); new spell_halfus_stone_touch(); + new spell_halfus_cyclone_winds(); + new spell_halfus_dancing_flames(); new achievement_the_only_escape(); } diff --git a/src/server/scripts/EasternKingdoms/BastionOfTwilight/instance_bastion_of_twilight.cpp b/src/server/scripts/EasternKingdoms/BastionOfTwilight/instance_bastion_of_twilight.cpp index 617e0673a05..db3730f9d0a 100644 --- a/src/server/scripts/EasternKingdoms/BastionOfTwilight/instance_bastion_of_twilight.cpp +++ b/src/server/scripts/EasternKingdoms/BastionOfTwilight/instance_bastion_of_twilight.cpp @@ -123,6 +123,10 @@ class instance_bastion_of_twilight : public InstanceMapScript case NPC_SPIKE: _halfusEncounterGUIDs.insert(creature->GetGUID()); break; + case NPC_INVISIBLE_STALKER: + if (creature->GetPositionZ() < 850.0f) + _dancingFlamesInvisibleStalkerGUIDs.insert(creature->GetGUID()); + break; default: break; } @@ -179,6 +183,7 @@ class instance_bastion_of_twilight : public InstanceMapScript } _deadOrphanedEmeraldWhelps = 0; + events.CancelEvent(EVENT_CAST_DANCING_FLAMES); } else if (state == DONE) { @@ -191,6 +196,8 @@ class instance_bastion_of_twilight : public InstanceMapScript if (GameObject* cage = GetGameObject(DATA_WHELP_CAGE)) cage->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); + + events.CancelEvent(EVENT_CAST_DANCING_FLAMES); } break; default: @@ -239,7 +246,10 @@ class instance_bastion_of_twilight : public InstanceMapScript if (entry == NPC_ORPHANED_EMERALD_WELP) protoBehemoth->AI()->DoAction(ACTION_ENABLE_SCORCHING_BREATH); if (entry == NPC_TIME_WARDEN) + { protoBehemoth->AI()->DoAction(ACTION_ENABLE_FIREBALL_BARRAGE); + events.RescheduleEvent(EVENT_CAST_DANCING_FLAMES, Milliseconds(500), Seconds(1)); + } } } } @@ -272,6 +282,27 @@ class instance_bastion_of_twilight : public InstanceMapScript return 0; } + void Update(uint32 diff) override + { + events.Update(diff); + + while (uint32 eventId = events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_CAST_DANCING_FLAMES: + if (ObjectGuid guid = Trinity::Containers::SelectRandomContainerElement(_dancingFlamesInvisibleStalkerGUIDs)) + if (Creature* cataclysmStalker = instance->GetCreature(guid)) + cataclysmStalker->CastSpell(cataclysmStalker, SPELL_DANCING_FLAMES_VISUAL, true); + + events.Repeat(Milliseconds(500), Seconds(1)); + break; + default: + break; + } + } + } + void WriteSaveDataMore(std::ostringstream& data) override { data << _unresponsiveDragonEntryFirst << ' ' @@ -290,15 +321,11 @@ class instance_bastion_of_twilight : public InstanceMapScript && _unresponsiveDragonEntrySecond != NPC_ORPHANED_EMERALD_WELP); } - /* - void Update(uint32 diff) override - { - } - */ - protected: + EventMap events; GuidSet _halfusEncounterGUIDs; GuidSet _spikeGUIDs; + GuidSet _dancingFlamesInvisibleStalkerGUIDs; std::set _activeDragonEntries; uint32 _unresponsiveDragonEntryFirst; uint32 _unresponsiveDragonEntrySecond;