diff --git a/data/sql/updates/pending_db_world/rev_1763691274545721000.sql b/data/sql/updates/pending_db_world/rev_1763691274545721000.sql new file mode 100644 index 000000000..d11643f1c --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1763691274545721000.sql @@ -0,0 +1,9 @@ +-- +DELETE FROM `spell_linked_spell` WHERE `spell_trigger` = 54581; +DELETE FROM `spell_script_names` WHERE `spell_id` = 54581; +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES +(54581, 'spell_mammoth_explosion'); + +DELETE FROM `smart_scripts` WHERE (`entryorguid` = 29402) AND (`source_type` = 0) AND (`id` IN (2)); +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `event_param5`, `event_param6`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_param4`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(29402, 0, 2, 0, 61, 0, 100, 512, 0, 0, 0, 0, 0, 0, 41, 3000, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Ironwool Mammoth - On Spellhit \'Throw U.D.E.D.\' - Despawn In 3000 ms'); diff --git a/src/server/scripts/Northrend/zone_storm_peaks.cpp b/src/server/scripts/Northrend/zone_storm_peaks.cpp index e940f8353..5c208f118 100644 --- a/src/server/scripts/Northrend/zone_storm_peaks.cpp +++ b/src/server/scripts/Northrend/zone_storm_peaks.cpp @@ -1166,6 +1166,43 @@ class spell_feed_stormcrest_eagle : public SpellScript } }; +enum MammothExplosion +{ + SPELL_MAMMOTH_EXPL_1 = 54627, + SPELL_MAMMOTH_EXPL_2 = 54628, + SPELL_MAMMOTH_EXPL_3 = 54623, + SPELL_MAIN_MAMMOTH_MEAT = 57444 +}; + +// 54581 - Mammoth Explosion Spell Spawner +class spell_mammoth_explosion : public SpellScript +{ + PrepareSpellScript(spell_mammoth_explosion); + + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_MAMMOTH_EXPL_1, SPELL_MAMMOTH_EXPL_2, SPELL_MAMMOTH_EXPL_3, SPELL_MAIN_MAMMOTH_MEAT }); + } + + void HandleOnEffectHit(SpellEffIndex /*effIndex*/) + { + if (Unit* target = GetHitUnit()) + { + for (uint32 spellId : { SPELL_MAMMOTH_EXPL_1, SPELL_MAMMOTH_EXPL_2, SPELL_MAMMOTH_EXPL_3 }) + target->CastSpell(GetHitUnit(), spellId, true); + + target->CastSpell(GetHitUnit(), SPELL_MAIN_MAMMOTH_MEAT, true); + + target->SetVisible(false); + } + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_mammoth_explosion::HandleOnEffectHit, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } +}; + void AddSC_storm_peaks() { RegisterCreatureAI(npc_frosthound); @@ -1183,4 +1220,5 @@ void AddSC_storm_peaks() new npc_vehicle_d16_propelled_delivery(); RegisterSpellScript(spell_q12823_remove_collapsing_cave_aura); RegisterSpellScript(spell_feed_stormcrest_eagle); + RegisterSpellScript(spell_mammoth_explosion); }