diff options
-rw-r--r-- | sql/updates/world/master/2022_09_05_16_world_2022_07_03_01_world.sql | 6 | ||||
-rw-r--r-- | src/server/scripts/EasternKingdoms/SunkenTemple/sunken_temple.cpp | 62 |
2 files changed, 68 insertions, 0 deletions
diff --git a/sql/updates/world/master/2022_09_05_16_world_2022_07_03_01_world.sql b/sql/updates/world/master/2022_09_05_16_world_2022_07_03_01_world.sql new file mode 100644 index 00000000000..0f40b759d34 --- /dev/null +++ b/sql/updates/world/master/2022_09_05_16_world_2022_07_03_01_world.sql @@ -0,0 +1,6 @@ +-- +DELETE FROM `spell_linked_spell` WHERE `spell_trigger` IN (-12480,12479,12480); +DELETE FROM `spell_script_names` WHERE `ScriptName` IN ('spell_sunken_temple_hex_of_jammalan','spell_sunken_temple_hex_of_jammalan_transform'); +INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES +(12479,'spell_sunken_temple_hex_of_jammalan'), +(12480,'spell_sunken_temple_hex_of_jammalan_transform'); diff --git a/src/server/scripts/EasternKingdoms/SunkenTemple/sunken_temple.cpp b/src/server/scripts/EasternKingdoms/SunkenTemple/sunken_temple.cpp index 5bb5f1431e9..18e62d1d88f 100644 --- a/src/server/scripts/EasternKingdoms/SunkenTemple/sunken_temple.cpp +++ b/src/server/scripts/EasternKingdoms/SunkenTemple/sunken_temple.cpp @@ -31,6 +31,8 @@ EndContentData */ #include "GameObjectAI.h" #include "InstanceScript.h" #include "Player.h" +#include "SpellAuraEffects.h" +#include "SpellScript.h" #include "sunken_temple.h" /*##### @@ -86,8 +88,68 @@ class go_atalai_statue : public GameObjectScript } }; +enum HexOfJammalan +{ + SPELL_HEX_OF_JAMMALAN_TRANSFORM = 12480, + SPELL_HEX_OF_JAMMALAN_CHARM = 12483 +}; + +// 12479 - Hex of Jammal'an +class spell_sunken_temple_hex_of_jammalan : public AuraScript +{ + PrepareAuraScript(spell_sunken_temple_hex_of_jammalan); + + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_HEX_OF_JAMMALAN_TRANSFORM, SPELL_HEX_OF_JAMMALAN_CHARM }); + } + + void AfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE) + return; + + Unit* target = GetTarget(); + Unit* caster = GetCaster(); + + if (!caster || !caster->IsAlive()) + return; + + caster->CastSpell(target, SPELL_HEX_OF_JAMMALAN_TRANSFORM, true); + caster->CastSpell(target, SPELL_HEX_OF_JAMMALAN_CHARM, true); + } + + void Register() override + { + AfterEffectRemove += AuraEffectRemoveFn(spell_sunken_temple_hex_of_jammalan::AfterRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + } +}; + +// 12480 - Hex of Jammal'an +class spell_sunken_temple_hex_of_jammalan_transform : public AuraScript +{ + PrepareAuraScript(spell_sunken_temple_hex_of_jammalan_transform); + + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_HEX_OF_JAMMALAN_CHARM }); + } + + void AfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + GetTarget()->RemoveAurasDueToSpell(SPELL_HEX_OF_JAMMALAN_CHARM); + } + + void Register() override + { + AfterEffectRemove += AuraEffectRemoveFn(spell_sunken_temple_hex_of_jammalan_transform::AfterRemove, EFFECT_0, SPELL_AURA_TRANSFORM, AURA_EFFECT_HANDLE_REAL); + } +}; + void AddSC_sunken_temple() { new at_malfurion_stormrage(); new go_atalai_statue(); + RegisterSpellScript(spell_sunken_temple_hex_of_jammalan); + RegisterSpellScript(spell_sunken_temple_hex_of_jammalan_transform); } |