From 368818a810b5c477a13106993567cf1825c7bbb5 Mon Sep 17 00:00:00 2001 From: Supabad Date: Wed, 6 Apr 2011 11:34:50 +0200 Subject: [PATCH] Core/Spells: replace spell Symbol Of Life from SpellEffects to SpellScript --- sql/scripts/world_scripts_full.sql | 1 + ...2011_04_03_10_world_spell_script_names.sql | 4 ++ src/server/game/Spells/SpellEffects.cpp | 1 - src/server/scripts/Spells/spell_quest.cpp | 43 +++++++++++++++++++ 4 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 sql/updates/world/2011_04_03_10_world_spell_script_names.sql diff --git a/sql/scripts/world_scripts_full.sql b/sql/scripts/world_scripts_full.sql index 7c7f67558..0ba5d667f 100644 --- a/sql/scripts/world_scripts_full.sql +++ b/sql/scripts/world_scripts_full.sql @@ -2123,6 +2123,7 @@ INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES ( 52308, 'spell_q12683_take_sputum_sample'), ( 55804, 'spell_q12937_relief_for_the_fallen'), ( 54798, 'spell_q12851_going_bearback'), +( 8593, 'spell_symbol_of_life_dummy'), -- item ( 23074, 'spell_item_arcanite_dragonling'), ( 8063, 'spell_item_deviate_fish'), diff --git a/sql/updates/world/2011_04_03_10_world_spell_script_names.sql b/sql/updates/world/2011_04_03_10_world_spell_script_names.sql new file mode 100644 index 000000000..c522d73ac --- /dev/null +++ b/sql/updates/world/2011_04_03_10_world_spell_script_names.sql @@ -0,0 +1,4 @@ +-- Add spell script +DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_symbol_of_life_dummy'; +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES +(8593, 'spell_symbol_of_life_dummy'); diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 10edae934..ca0e1d594 100755 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -781,7 +781,6 @@ void Spell::EffectDummy(SpellEffIndex effIndex) { switch (m_spellInfo->Id) { - case 8593: // Symbol of life (restore creature to life) case 31225: // Shimmering Vessel (restore creature to life) { if (!unitTarget || unitTarget->GetTypeId() != TYPEID_UNIT) diff --git a/src/server/scripts/Spells/spell_quest.cpp b/src/server/scripts/Spells/spell_quest.cpp index b45038e52..e1e66a04b 100644 --- a/src/server/scripts/Spells/spell_quest.cpp +++ b/src/server/scripts/Spells/spell_quest.cpp @@ -776,6 +776,48 @@ class spell_q10041_q10040_who_are_they : public SpellScriptLoader } }; +enum symboloflife +{ + SPELL_PERMANENT_FEIGN_DEATH = 29266, +}; + +// 8593 Symbol of life dummy +class spell_symbol_of_life_dummy : public SpellScriptLoader +{ +public: + spell_symbol_of_life_dummy() : SpellScriptLoader("spell_symbol_of_life_dummy") { } + + class spell_symbol_of_life_dummy_SpellScript : public SpellScript + { + PrepareSpellScript(spell_symbol_of_life_dummy_SpellScript); + + void HandleDummy(SpellEffIndex /*effIndex*/) + { + if (Creature* target = GetTargetUnit()->ToCreature()) + { + if (target->HasAura(SPELL_PERMANENT_FEIGN_DEATH)) + { + target->RemoveAurasDueToSpell(SPELL_PERMANENT_FEIGN_DEATH); + target->SetUInt32Value(UNIT_DYNAMIC_FLAGS, 0); + target->SetUInt32Value(UNIT_FIELD_FLAGS_2, 0); + target->SetHealth(target->GetMaxHealth() / 2); + target->SetPower(POWER_MANA, target->GetMaxPower(POWER_MANA) * 0.75); + } + } + } + + void Register() + { + OnEffect += SpellEffectFn(spell_symbol_of_life_dummy_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_symbol_of_life_dummy_SpellScript(); + }; +}; + void AddSC_quest_spell_scripts() { new spell_q55_sacred_cleansing(); @@ -794,4 +836,5 @@ void AddSC_quest_spell_scripts() new spell_q12851_going_bearback(); new spell_q12937_relief_for_the_fallen(); new spell_q10041_q10040_who_are_they(); + new spell_symbol_of_life_dummy(); }